diff options
230 files changed, 3745 insertions, 3735 deletions
diff --git a/chart2/source/view/main/ChartItemPool.cxx b/chart2/source/view/main/ChartItemPool.cxx index 894955bc10dd..d0a7b5ce87d7 100644 --- a/chart2/source/view/main/ChartItemPool.cxx +++ b/chart2/source/view/main/ChartItemPool.cxx @@ -157,8 +157,8 @@ ChartItemPool::ChartItemPool(): rPoolDefaults[SCHATTR_REGRESSION_SET_INTERCEPT - SCHATTR_START] = new SfxBoolItem(SCHATTR_REGRESSION_SET_INTERCEPT, false); rPoolDefaults[SCHATTR_REGRESSION_INTERCEPT_VALUE - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_REGRESSION_INTERCEPT_VALUE); rPoolDefaults[SCHATTR_REGRESSION_CURVE_NAME - SCHATTR_START] = new SfxStringItem(SCHATTR_REGRESSION_CURVE_NAME, OUString()); - rPoolDefaults[SCHATTR_REGRESSION_XNAME - SCHATTR_START] = new SfxStringItem(SCHATTR_REGRESSION_XNAME, OUString("x")); - rPoolDefaults[SCHATTR_REGRESSION_YNAME - SCHATTR_START] = new SfxStringItem(SCHATTR_REGRESSION_YNAME, OUString("f(x)")); + rPoolDefaults[SCHATTR_REGRESSION_XNAME - SCHATTR_START] = new SfxStringItem(SCHATTR_REGRESSION_XNAME, "x"); + rPoolDefaults[SCHATTR_REGRESSION_YNAME - SCHATTR_START] = new SfxStringItem(SCHATTR_REGRESSION_YNAME, "f(x)"); /************************************************************************** * ItemInfos diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx index 063b7ede1b8a..20f67d2e570d 100644 --- a/cui/source/dialogs/hldocntp.cxx +++ b/cui/source/dialogs/hldocntp.cxx @@ -309,8 +309,8 @@ IMPL_STATIC_LINK(SvxHyperlinkNewDocTp, DispatchDocument, void*, p, void) // create items SfxStringItem aName( SID_FILE_NAME, xExecuteInfo->aStrDocName ); - SfxStringItem aReferer( SID_REFERER, OUString("private:user") ); - SfxStringItem aFrame( SID_TARGETNAME, OUString("_blank") ); + SfxStringItem aReferer( SID_REFERER, "private:user" ); + SfxStringItem aFrame( SID_TARGETNAME, "_blank"); OUString aStrFlags('S'); if (xExecuteInfo->bRbtEditLater) diff --git a/cui/source/inc/tabstpge.hxx b/cui/source/inc/tabstpge.hxx index 3288e0536ffb..949877077bd2 100644 --- a/cui/source/inc/tabstpge.hxx +++ b/cui/source/inc/tabstpge.hxx @@ -82,7 +82,7 @@ private: // local variables, internal functions SvxTabStop aCurrentTab; - SvxTabStopItem aNewTabs; + std::unique_ptr<SvxTabStopItem> aNewTabs; long nDefDist; TabWin_Impl m_aLeftWin; diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx index dc15fb3a0cf6..bcfa66d42132 100644 --- a/cui/source/tabpages/backgrnd.cxx +++ b/cui/source/tabpages/backgrnd.cxx @@ -396,12 +396,14 @@ void SvxBackgroundTabPage::Reset( const SfxItemSet* rSet ) if (USHRT_MAX == nDestValue && m_xTblLBox->get_visible()) nDestValue = 0; sal_uInt16 nWhich = GetWhich(nSlot); - SvxBrushItem aBgdAttr(nWhich); + std::shared_ptr<SvxBrushItem> aBgdAttr(std::make_shared<SvxBrushItem>(nWhich)); if (rSet->GetItemState( nWhich, false ) >= SfxItemState::DEFAULT) { if (!bCharBackColor) - aBgdAttr = static_cast<const SvxBrushItem&>(rSet->Get(nWhich)); + { + aBgdAttr.reset(static_cast<SvxBrushItem*>(rSet->Get(nWhich).Clone())); + } else { // EE_CHAR_BKGCOLOR is SvxBackgroundColorItem, but char background tabpage @@ -409,7 +411,7 @@ void SvxBackgroundTabPage::Reset( const SfxItemSet* rSet ) // extract Color out of SvxBackColorItem Color aBackColor = static_cast<const SvxBackgroundColorItem&>(rSet->Get(nWhich)).GetValue(); // make new SvxBrushItem with this Color - aBgdAttr = SvxBrushItem(aBackColor, SID_ATTR_BRUSH_CHAR); + aBgdAttr = std::make_shared<SvxBrushItem>(aBackColor, SID_ATTR_BRUSH_CHAR); } bBrushItemSet = true; } @@ -418,8 +420,8 @@ void SvxBackgroundTabPage::Reset( const SfxItemSet* rSet ) if (bBrushItemSet) { - FillControls_Impl(aBgdAttr, aUserData); - aBgdColor = aBgdAttr.GetColor(); + FillControls_Impl(*aBgdAttr, aUserData); + aBgdColor = aBgdAttr->GetColor(); } else { @@ -446,22 +448,19 @@ void SvxBackgroundTabPage::Reset( const SfxItemSet* rSet ) nWhich = GetWhich( SID_ATTR_BRUSH ); if ( rSet->GetItemState( nWhich, false ) >= SfxItemState::DEFAULT ) { - aBgdAttr = static_cast<const SvxBrushItem&>(rSet->Get(nWhich)); - m_pCellBrush.reset(new SvxBrushItem(aBgdAttr)); + m_pCellBrush.reset(static_cast<SvxBrushItem*>(rSet->Get(nWhich).Clone())); } m_nCellWhich = nWhich; if ( rSet->GetItemState( SID_ATTR_BRUSH_ROW, false ) >= SfxItemState::DEFAULT ) { - aBgdAttr = static_cast<const SvxBrushItem&>(rSet->Get(SID_ATTR_BRUSH_ROW)); - m_pRowBrush.reset(new SvxBrushItem(aBgdAttr)); + m_pRowBrush.reset(static_cast<SvxBrushItem*>(rSet->Get(SID_ATTR_BRUSH_ROW).Clone())); } m_nRowWhich = SID_ATTR_BRUSH_ROW; if ( rSet->GetItemState( SID_ATTR_BRUSH_TABLE, false ) >= SfxItemState::DEFAULT ) { - aBgdAttr = static_cast<const SvxBrushItem&>(rSet->Get(SID_ATTR_BRUSH_TABLE)); - m_pTableBrush.reset(new SvxBrushItem(aBgdAttr)); + m_pTableBrush.reset(static_cast<SvxBrushItem*>(rSet->Get(SID_ATTR_BRUSH_TABLE).Clone())); } m_nTableWhich = SID_ATTR_BRUSH_TABLE; @@ -473,8 +472,7 @@ void SvxBackgroundTabPage::Reset( const SfxItemSet* rSet ) nWhich = GetWhich( SID_ATTR_BRUSH_CHAR ); if ( rSet->GetItemState( nWhich, false ) >= SfxItemState::DEFAULT ) { - aBgdAttr = static_cast<const SvxBrushItem&>(rSet->Get(nWhich)); - pHighlighting.reset(new SvxBrushItem(aBgdAttr)); + pHighlighting.reset(static_cast<SvxBrushItem*>(rSet->Get(nWhich).Clone())); } } else if( bCharBackColor ) @@ -487,8 +485,7 @@ void SvxBackgroundTabPage::Reset( const SfxItemSet* rSet ) // extract Color out of SvxBackColorItem Color aBackColor = static_cast<const SvxBackgroundColorItem&>(rSet->Get(nWhich)).GetValue(); // make new SvxBrushItem with this Color - aBgdAttr = SvxBrushItem(aBackColor, SID_ATTR_BRUSH_CHAR); - pHighlighting.reset(new SvxBrushItem(aBgdAttr)); + pHighlighting = std::make_unique<SvxBrushItem>(aBackColor, SID_ATTR_BRUSH_CHAR); } } } @@ -596,21 +593,23 @@ bool SvxBackgroundTabPage::FillItemSet( SfxItemSet* rCoreSet ) if (bModifyBrush) { bModified = true; + std::unique_ptr<SvxBrushItem> aTmpBrush; - SvxBrushItem aTmpBrush(nWhich); if ( bIsLink ) { - aTmpBrush = SvxBrushItem( aBgdGraphicPath, + aTmpBrush.reset(new SvxBrushItem( aBgdGraphicPath, aBgdGraphicFilter, eNewPos, - nWhich ); + nWhich )); } else - aTmpBrush = SvxBrushItem( aBgdGraphic, + { + aTmpBrush.reset(new SvxBrushItem( aBgdGraphic, eNewPos, - nWhich ); + nWhich )); + } - rCoreSet->Put(aTmpBrush); + rCoreSet->Put(*aTmpBrush); } else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) ) rCoreSet->ClearItem( nWhich ); @@ -1133,20 +1132,20 @@ IMPL_LINK(SvxBackgroundTabPage, TblDestinationHdl_Impl, weld::ComboBox&, rBox, v if( m_nActPos != nSelPos) { std::unique_ptr<SvxBrushItem> xItemHolder; - SvxBrushItem* pActItem = nullptr; + std::unique_ptr<SvxBrushItem>* pActItem = nullptr; sal_uInt16 nWhich = 0; switch(m_nActPos) { case TBL_DEST_CELL: - pActItem = m_pCellBrush.get(); + pActItem = &m_pCellBrush; nWhich = m_nCellWhich; break; case TBL_DEST_ROW: - pActItem = m_pRowBrush.get(); + pActItem = &m_pRowBrush; nWhich = m_nRowWhich; break; case TBL_DEST_TBL: - pActItem = m_pTableBrush.get(); + pActItem = &m_pTableBrush; nWhich = m_nTableWhich; break; default: @@ -1157,11 +1156,11 @@ IMPL_LINK(SvxBackgroundTabPage, TblDestinationHdl_Impl, weld::ComboBox&, rBox, v if(!pActItem) { xItemHolder.reset(new SvxBrushItem(nWhich)); - pActItem = xItemHolder.get(); + pActItem = &xItemHolder; } if(drawing::FillStyle_SOLID == lcl_getFillStyle(*m_xLbSelect)) // brush selected { - *pActItem = SvxBrushItem( aBgdColor, nWhich ); + *pActItem = std::make_unique<SvxBrushItem>(aBgdColor, nWhich); } else { @@ -1172,28 +1171,32 @@ IMPL_LINK(SvxBackgroundTabPage, TblDestinationHdl_Impl, weld::ComboBox&, rBox, v bIsGraphicValid = LoadLinkedGraphic_Impl(); if ( bIsLink ) - *pActItem = SvxBrushItem( aBgdGraphicPath, + { + *pActItem = std::make_unique<SvxBrushItem>( aBgdGraphicPath, aBgdGraphicFilter, eNewPos, - pActItem->Which() ); + (*pActItem)->Which() ); + } else - *pActItem = SvxBrushItem( aBgdGraphic, + { + *pActItem = std::make_unique<SvxBrushItem>( aBgdGraphic, eNewPos, - pActItem->Which() ); + (*pActItem)->Which() ); + } } switch(nSelPos) { case TBL_DEST_CELL: - pActItem = m_pCellBrush.get(); + pActItem = &m_pCellBrush; m_xLbSelect->set_sensitive(true); nWhich = m_nCellWhich; break; case TBL_DEST_ROW: - pActItem = m_pRowBrush.get(); + pActItem = &m_pRowBrush; nWhich = m_nRowWhich; break; case TBL_DEST_TBL: - pActItem = m_pTableBrush.get(); + pActItem = &m_pTableBrush; m_xLbSelect->set_sensitive(true); nWhich = m_nTableWhich; break; @@ -1208,9 +1211,9 @@ IMPL_LINK(SvxBackgroundTabPage, TblDestinationHdl_Impl, weld::ComboBox&, rBox, v if (!pActItem) { xItemHolder.reset(new SvxBrushItem(nWhich)); - pActItem = xItemHolder.get(); + pActItem = &xItemHolder; } - FillControls_Impl(*pActItem, aUserData); + FillControls_Impl(**pActItem, aUserData); } } @@ -1492,9 +1495,9 @@ bool SvxBkgTabPage::FillItemSet( SfxItemSet* rCoreSet ) } case drawing::FillStyle_BITMAP: { - SvxBrushItem aBrushItem( getSvxBrushItemFromSourceSet( maSet, nWhich ) ); - if ( GraphicType::NONE != aBrushItem.GetGraphicObject()->GetType() ) - rCoreSet->Put( aBrushItem ); + std::shared_ptr<SvxBrushItem> aBrushItem( getSvxBrushItemFromSourceSet( maSet, nWhich ) ); + if ( GraphicType::NONE != aBrushItem->GetGraphicObject()->GetType() ) + rCoreSet->Put( *aBrushItem ); break; } default: @@ -1597,7 +1600,7 @@ IMPL_LINK(SvxBkgTabPage, TblDestinationHdl_Impl, weld::ComboBox&, rBox, void) // fill local item set with XATTR_FILL settings gathered from tab page // and convert to SvxBrushItem and store in table destination slot Which SvxAreaTabPage::FillItemSet(&maSet); - maSet.Put(getSvxBrushItemFromSourceSet(maSet, maSet.GetPool()->GetWhich(lcl_GetTableDestSlot(m_nActPos)))); + maSet.Put(*getSvxBrushItemFromSourceSet(maSet, maSet.GetPool()->GetWhich(lcl_GetTableDestSlot(m_nActPos)))); } sal_Int32 nSelPos = rBox.get_active(); diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx index 648c6c6c366e..b9e04205f6af 100644 --- a/cui/source/tabpages/grfpage.cxx +++ b/cui/source/tabpages/grfpage.cxx @@ -229,27 +229,30 @@ bool SvxGrfCropPage::FillItemSet(SfxItemSet *rSet) sal_uInt16 nW = rPool.GetWhich( SID_ATTR_GRAF_FRMSIZE ); FieldUnit eUnit = MapToFieldUnit( rSet->GetPool()->GetMetric( nW )); - SvxSizeItem aSz( nW ); + std::shared_ptr<SvxSizeItem> aSz(std::make_shared<SvxSizeItem>(nW)); // size could already have been set from another page const SfxItemSet* pExSet = GetDialogExampleSet(); const SfxPoolItem* pItem = nullptr; - if( pExSet && SfxItemState::SET == - pExSet->GetItemState( nW, false, &pItem ) ) - aSz = *static_cast<const SvxSizeItem*>(pItem); + if( pExSet && SfxItemState::SET ==pExSet->GetItemState( nW, false, &pItem ) ) + { + aSz.reset(static_cast< SvxSizeItem*>(pItem->Clone())); + } else - aSz = static_cast<const SvxSizeItem&>(GetItemSet().Get( nW )); + { + aSz.reset(static_cast< SvxSizeItem*>(GetItemSet().Get(nW).Clone())); + } - Size aTmpSz( aSz.GetSize() ); + Size aTmpSz( aSz->GetSize() ); if( m_xWidthMF->get_value_changed_from_saved() ) aTmpSz.setWidth( lcl_GetValue( *m_xWidthMF, eUnit ) ); if( m_xHeightMF->get_value_changed_from_saved() ) aTmpSz.setHeight( lcl_GetValue( *m_xHeightMF, eUnit ) ); - aSz.SetSize( aTmpSz ); + aSz->SetSize( aTmpSz ); m_xWidthMF->save_value(); m_xHeightMF->save_value(); - bModified |= nullptr != rSet->Put( aSz ); + bModified |= nullptr != rSet->Put( *aSz ); if( bSetOrigSize ) { diff --git a/cui/source/tabpages/tabstpge.cxx b/cui/source/tabpages/tabstpge.cxx index e4e92fc1c90b..3ff07765f8af 100644 --- a/cui/source/tabpages/tabstpge.cxx +++ b/cui/source/tabpages/tabstpge.cxx @@ -64,7 +64,7 @@ void TabWin_Impl::Paint(vcl::RenderContext& rRenderContext, const ::tools::Recta SvxTabulatorTabPage::SvxTabulatorTabPage(TabPageParent pParent, const SfxItemSet& rAttr) : SfxTabPage(pParent, "cui/ui/paratabspage.ui", "ParagraphTabsPage", &rAttr) , aCurrentTab(0) - , aNewTabs(0, 0, SvxTabAdjust::Left, GetWhich(SID_ATTR_TABSTOP)) + , aNewTabs(std::make_unique<SvxTabStopItem>(0, 0, SvxTabAdjust::Left, GetWhich(SID_ATTR_TABSTOP))) , nDefDist(0) , m_xTabSpin(m_xBuilder->weld_metric_spin_button("SP_TABPOS", FieldUnit::CM)) , m_xTabBox(m_xBuilder->weld_entry_tree_view("tabgrid", "ED_TABPOS", "LB_TABPOS")) @@ -171,7 +171,7 @@ bool SvxTabulatorTabPage::FillItemSet(SfxItemSet* rSet) GetDezCharHdl_Impl(*m_xDezChar); GetFillCharHdl_Impl(*m_xFillChar); - FillUpWithDefTabs_Impl(nDefDist, aNewTabs); + FillUpWithDefTabs_Impl(nDefDist, *aNewTabs); SfxItemPool* pPool = rSet->GetPool(); MapUnit eUnit = pPool->GetMetric(GetWhich(SID_ATTR_TABSTOP)); const SfxPoolItem* pOld = GetOldItem(*rSet, SID_ATTR_TABSTOP); @@ -188,28 +188,28 @@ bool SvxTabulatorTabPage::FillItemSet(SfxItemSet* rSet) if (pLRSpace && static_cast<const SvxLRSpaceItem*>(pLRSpace)->GetTextFirstLineOfst() < 0) { SvxTabStop aNull(0, SvxTabAdjust::Default); - aNewTabs.Insert(aNull); + aNewTabs->Insert(aNull); } - SvxTabStopItem aTmp(aNewTabs); - aTmp.Remove(0, aTmp.Count()); + std::unique_ptr<SvxTabStopItem> aTmp(static_cast<SvxTabStopItem*>(aNewTabs->Clone())); + aTmp->Remove(0, aTmp->Count()); - for (sal_uInt16 i = 0; i < aNewTabs.Count(); ++i) + for (sal_uInt16 i = 0; i < aNewTabs->Count(); ++i) { - SvxTabStop aTmpStop = aNewTabs[i]; + SvxTabStop aTmpStop = (*aNewTabs)[i]; aTmpStop.GetTabPos() = LogicToLogic(aTmpStop.GetTabPos(), MapUnit::Map100thMM, eUnit); - aTmp.Insert(aTmpStop); + aTmp->Insert(aTmpStop); } - if (!pOld || *static_cast<const SvxTabStopItem*>(pOld) != aTmp) + if (!pOld || *static_cast<const SvxTabStopItem*>(pOld) != *aTmp) { - rSet->Put(aTmp); + rSet->Put(*aTmp); bModified = true; } } - else if (!pOld || *static_cast<const SvxTabStopItem*>(pOld) != aNewTabs) + else if (!pOld || *static_cast<const SvxTabStopItem*>(pOld) != *aNewTabs) { - rSet->Put(aNewTabs); + rSet->Put(*aNewTabs); bModified = true; } @@ -233,21 +233,25 @@ void SvxTabulatorTabPage::Reset(const SfxItemSet* rSet) { if (MapUnit::Map100thMM != eUnit) { - SvxTabStopItem aTmp(*static_cast<const SvxTabStopItem*>(pItem)); - aNewTabs.Remove(0, aNewTabs.Count()); + std::unique_ptr<SvxTabStopItem> aTmp(static_cast<SvxTabStopItem*>(pItem->Clone())); + aNewTabs->Remove(0, aNewTabs->Count()); - for (sal_uInt16 i = 0; i < aTmp.Count(); ++i) + for (sal_uInt16 i = 0; i < aTmp->Count(); ++i) { - SvxTabStop aTmpStop = aTmp[i]; + SvxTabStop aTmpStop = (*aTmp)[i]; aTmpStop.GetTabPos() = LogicToLogic(aTmpStop.GetTabPos(), eUnit, MapUnit::Map100thMM); - aNewTabs.Insert(aTmpStop); + aNewTabs->Insert(aTmpStop); } } else - aNewTabs = *static_cast<const SvxTabStopItem*>(pItem); + { + aNewTabs.reset(static_cast<SvxTabStopItem*>(pItem->Clone())); + } } else - aNewTabs.Remove(0, aNewTabs.Count()); + { + aNewTabs->Remove(0, aNewTabs->Count()); + } // Default tab distance nDefDist = SVX_TAB_DEFDIST; @@ -330,20 +334,21 @@ void SvxTabulatorTabPage::InitTabPos_Impl( sal_uInt16 nTabPos ) } // Correct current TabPos and default tabs - for ( sal_uInt16 i = 0; i < aNewTabs.Count(); i++ ) + for ( sal_uInt16 i = 0; i < aNewTabs->Count(); i++ ) { - if ( aNewTabs[i].GetAdjustment() != SvxTabAdjust::Default ) + if ( (*aNewTabs)[i].GetAdjustment() != SvxTabAdjust::Default ) { - m_xTabSpin->set_value(m_xTabSpin->normalize( - aNewTabs[i].GetTabPos() + nOffset ), eDefUnit); + m_xTabSpin->set_value(m_xTabSpin->normalize((*aNewTabs)[i].GetTabPos() + nOffset ), eDefUnit); m_xTabBox->append_text(m_xTabSpin->get_text()); } else - aNewTabs.Remove( i-- ); + { + aNewTabs->Remove( i-- ); + } } // Select current tabulator - const sal_uInt16 nSize = aNewTabs.Count(); + const sal_uInt16 nSize = aNewTabs->Count(); if ( nTabPos >= nSize ) nTabPos = 0; @@ -355,7 +360,7 @@ void SvxTabulatorTabPage::InitTabPos_Impl( sal_uInt16 nTabPos ) if (m_xTabBox->get_count() > 0) { m_xTabBox->set_active(nTabPos); - aCurrentTab = aNewTabs[nTabPos]; + aCurrentTab = (*aNewTabs)[nTabPos]; SetFillAndTabType_Impl(); m_xNewBtn->set_sensitive(false); @@ -449,7 +454,7 @@ void SvxTabulatorTabPage::NewHdl_Impl(const weld::Button* pBtn) sal_Int32 i; for( i = 0; i < nSize; i++ ) { - if ( nReal < aNewTabs[i].GetTabPos() ) + if ( nReal < (*aNewTabs)[i].GetTabPos() ) break; } @@ -468,7 +473,7 @@ void SvxTabulatorTabPage::NewHdl_Impl(const weld::Button* pBtn) eAdj = SvxTabAdjust::Decimal; aCurrentTab.GetAdjustment() = eAdj; - aNewTabs.Insert( aCurrentTab ); + aNewTabs->Insert( aCurrentTab ); m_xNewBtn->set_sensitive(false); m_xDelBtn->set_sensitive(true); @@ -497,17 +502,17 @@ IMPL_LINK_NOARG(SvxTabulatorTabPage, DelHdl_Impl, weld::Button&, void) // Delete Tab m_xTabBox->remove(nPos); - aNewTabs.Remove( nPos ); + aNewTabs->Remove( nPos ); // Reset aCurrentTab - const sal_uInt16 nSize = aNewTabs.Count(); + const sal_uInt16 nSize = aNewTabs->Count(); if ( nSize > 0 ) { // Correct Pos nPos = ( ( nSize - 1 ) >= nPos) ? nPos : nPos - 1; m_xTabBox->set_active(nPos); - aCurrentTab = aNewTabs[nPos]; + aCurrentTab = (*aNewTabs)[nPos]; } // If no Tabs Enable Disable Controls @@ -521,9 +526,9 @@ IMPL_LINK_NOARG(SvxTabulatorTabPage, DelHdl_Impl, weld::Button&, void) IMPL_LINK_NOARG(SvxTabulatorTabPage, DelAllHdl_Impl, weld::Button&, void) { - if ( aNewTabs.Count() ) + if ( aNewTabs->Count() ) { - aNewTabs = SvxTabStopItem( 0 ); + aNewTabs = std::make_unique<SvxTabStopItem>( 0 ); InitTabPos_Impl(); } } @@ -553,8 +558,8 @@ IMPL_LINK(SvxTabulatorTabPage, TabTypeCheckHdl_Impl, weld::Button&, rBox, void) int nPos = FindCurrentTab(); if (nPos != -1) { - aNewTabs.Remove( nPos ); - aNewTabs.Insert( aCurrentTab ); + aNewTabs->Remove( nPos ); + aNewTabs->Insert( aCurrentTab ); } } @@ -579,8 +584,8 @@ IMPL_LINK(SvxTabulatorTabPage, FillTypeCheckHdl_Impl, weld::Button&, rBox, void) int nPos = FindCurrentTab(); if (nPos != -1) { - aNewTabs.Remove( nPos ); - aNewTabs.Insert( aCurrentTab ); + aNewTabs->Remove( nPos ); + aNewTabs->Insert( aCurrentTab ); } } @@ -593,8 +598,8 @@ IMPL_LINK_NOARG(SvxTabulatorTabPage, GetFillCharHdl_Impl, weld::Widget&, void) const int nPos = FindCurrentTab(); if (nPos != -1) { - aNewTabs.Remove( nPos ); - aNewTabs.Insert( aCurrentTab ); + aNewTabs->Remove( nPos ); + aNewTabs->Insert( aCurrentTab ); } } @@ -607,8 +612,8 @@ IMPL_LINK_NOARG(SvxTabulatorTabPage, GetDezCharHdl_Impl, weld::Widget&, void) const int nPos = FindCurrentTab(); if (nPos != -1) { - aNewTabs.Remove( nPos ); - aNewTabs.Insert( aCurrentTab ); + aNewTabs->Remove( nPos ); + aNewTabs->Insert( aCurrentTab ); } } @@ -617,7 +622,7 @@ IMPL_LINK_NOARG(SvxTabulatorTabPage, SelectHdl_Impl, weld::TreeView&, void) const int nPos = FindCurrentTab(); if (nPos != -1) { - aCurrentTab = aNewTabs[nPos]; + aCurrentTab = (*aNewTabs)[nPos]; m_xNewBtn->set_sensitive(false); SetFillAndTabType_Impl(); } @@ -640,7 +645,7 @@ IMPL_LINK_NOARG(SvxTabulatorTabPage, ModifyHdl_Impl, weld::ComboBox&, void) const int nPos = FindCurrentTab(); if (nPos != -1) { - aCurrentTab = aNewTabs[nPos]; + aCurrentTab = (*aNewTabs)[nPos]; SetFillAndTabType_Impl(); m_xTabSpin->set_text(m_xTabBox->get_active_text()); diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx index bf6b8ec4a149..83b8bf1c2ce4 100644 --- a/dbaccess/source/ui/dlg/dbadmin.cxx +++ b/dbaccess/source/ui/dlg/dbadmin.cxx @@ -294,7 +294,7 @@ void ODbAdminDialog::createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, SfxItemP *pCounter++ = new SfxStringItem(DSID_TEXTDELIMITER, OUString('"')); *pCounter++ = new SfxStringItem(DSID_DECIMALDELIMITER, OUString('.')); *pCounter++ = new SfxStringItem(DSID_THOUSANDSDELIMITER, OUString()); - *pCounter++ = new SfxStringItem(DSID_TEXTFILEEXTENSION, OUString("txt")); + *pCounter++ = new SfxStringItem(DSID_TEXTFILEEXTENSION, "txt"); *pCounter++ = new SfxBoolItem(DSID_TEXTFILEHEADER, true); *pCounter++ = new SfxBoolItem(DSID_PARAMETERNAMESUBST, false); *pCounter++ = new SfxInt32Item(DSID_CONN_PORTNUMBER, 8100); diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx index f9328b841d29..829333294d05 100644 --- a/dbaccess/source/ui/dlg/generalpage.cxx +++ b/dbaccess/source/ui/dlg/generalpage.cxx @@ -617,7 +617,7 @@ namespace dbaui if ( m_pRB_CreateDatabase->IsChecked() ) { - _rCoreAttrs->Put( SfxStringItem( DSID_CONNECTURL, OUString( "sdbc:dbase:" ) ) ); + _rCoreAttrs->Put( SfxStringItem( DSID_CONNECTURL, "sdbc:dbase:" ) ); bChangedSomething = true; bCommitTypeSelection = false; } diff --git a/editeng/Library_editeng.mk b/editeng/Library_editeng.mk index 87e23b8628da..9354071b3a70 100644 --- a/editeng/Library_editeng.mk +++ b/editeng/Library_editeng.mk @@ -77,6 +77,7 @@ $(eval $(call gb_Library_add_exception_objects,editeng,\ editeng/source/items/itemtype \ editeng/source/items/justifyitem \ editeng/source/items/numitem \ + editeng/source/items/legacyitem \ editeng/source/items/optitems \ editeng/source/items/paperinf \ editeng/source/items/paraitem \ diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 8c27e0dbf09a..ef5964c822f5 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -816,16 +816,16 @@ void ContentAttribsInfo::AppendCharAttrib(EditCharAttrib* pNew) aPrevCharAttribs.push_back(std::unique_ptr<EditCharAttrib>(pNew)); } -void ConvertItem( SfxPoolItem& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit ) +void ConvertItem( std::unique_ptr<SfxPoolItem>& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit ) { DBG_ASSERT( eSourceUnit != eDestUnit, "ConvertItem - Why?!" ); - switch ( rPoolItem.Which() ) + switch ( rPoolItem->Which() ) { case EE_PARA_LRSPACE: { - assert(dynamic_cast<const SvxLRSpaceItem *>(&rPoolItem) != nullptr); - SvxLRSpaceItem& rItem = static_cast<SvxLRSpaceItem&>(rPoolItem); + assert(dynamic_cast<const SvxLRSpaceItem *>(rPoolItem.get()) != nullptr); + SvxLRSpaceItem& rItem = static_cast<SvxLRSpaceItem&>(*rPoolItem); rItem.SetTextFirstLineOfst( sal::static_int_cast< short >( OutputDevice::LogicToLogic( rItem.GetTextFirstLineOfst(), eSourceUnit, eDestUnit ) ) ); rItem.SetTextLeft( OutputDevice::LogicToLogic( rItem.GetTextLeft(), eSourceUnit, eDestUnit ) ); rItem.SetRight( OutputDevice::LogicToLogic( rItem.GetRight(), eSourceUnit, eDestUnit ) ); @@ -833,16 +833,16 @@ void ConvertItem( SfxPoolItem& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit break; case EE_PARA_ULSPACE: { - assert(dynamic_cast<const SvxULSpaceItem *>(&rPoolItem) != nullptr); - SvxULSpaceItem& rItem = static_cast<SvxULSpaceItem&>(rPoolItem); + assert(dynamic_cast<const SvxULSpaceItem *>(rPoolItem.get()) != nullptr); + SvxULSpaceItem& rItem = static_cast<SvxULSpaceItem&>(*rPoolItem); rItem.SetUpper( sal::static_int_cast< sal_uInt16 >( OutputDevice::LogicToLogic( rItem.GetUpper(), eSourceUnit, eDestUnit ) ) ); rItem.SetLower( sal::static_int_cast< sal_uInt16 >( OutputDevice::LogicToLogic( rItem.GetLower(), eSourceUnit, eDestUnit ) ) ); } break; case EE_PARA_SBL: { - assert(dynamic_cast<const SvxLineSpacingItem *>(&rPoolItem) != nullptr); - SvxLineSpacingItem& rItem = static_cast<SvxLineSpacingItem&>(rPoolItem); + assert(dynamic_cast<const SvxLineSpacingItem *>(rPoolItem.get()) != nullptr); + SvxLineSpacingItem& rItem = static_cast<SvxLineSpacingItem&>(*rPoolItem); // SetLineHeight changes also eLineSpace! if ( rItem.GetLineSpaceRule() == SvxLineSpaceRule::Min ) rItem.SetLineHeight( sal::static_int_cast< sal_uInt16 >( OutputDevice::LogicToLogic( rItem.GetLineHeight(), eSourceUnit, eDestUnit ) ) ); @@ -850,24 +850,24 @@ void ConvertItem( SfxPoolItem& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit break; case EE_PARA_TABS: { - assert(dynamic_cast<const SvxTabStopItem *>(&rPoolItem) != nullptr); - SvxTabStopItem& rItem = static_cast<SvxTabStopItem&>(rPoolItem); - SvxTabStopItem aNewItem( EE_PARA_TABS ); + assert(dynamic_cast<const SvxTabStopItem *>(rPoolItem.get()) != nullptr); + SvxTabStopItem& rItem = static_cast<SvxTabStopItem&>(*rPoolItem); + SvxTabStopItem* pNewItem(new SvxTabStopItem(EE_PARA_TABS)); for ( sal_uInt16 i = 0; i < rItem.Count(); i++ ) { const SvxTabStop& rTab = rItem[i]; SvxTabStop aNewStop( OutputDevice::LogicToLogic( rTab.GetTabPos(), eSourceUnit, eDestUnit ), rTab.GetAdjustment(), rTab.GetDecimal(), rTab.GetFill() ); - aNewItem.Insert( aNewStop ); + pNewItem->Insert( aNewStop ); } - rItem = aNewItem; + rPoolItem.reset(pNewItem); } break; case EE_CHAR_FONTHEIGHT: case EE_CHAR_FONTHEIGHT_CJK: case EE_CHAR_FONTHEIGHT_CTL: { - assert(dynamic_cast<const SvxFontHeightItem *>(&rPoolItem) != nullptr); - SvxFontHeightItem& rItem = static_cast<SvxFontHeightItem&>(rPoolItem); + assert(dynamic_cast<const SvxFontHeightItem *>(rPoolItem.get()) != nullptr); + SvxFontHeightItem& rItem = static_cast<SvxFontHeightItem&>(*rPoolItem); rItem.SetHeight( OutputDevice::LogicToLogic( rItem.GetHeight(), eSourceUnit, eDestUnit ) ); } break; @@ -899,7 +899,7 @@ void ConvertAndPutItems( SfxItemSet& rDest, const SfxItemSet& rSource, const Map if ( eSourceUnit != eDestUnit ) { std::unique_ptr<SfxPoolItem> pItem(rSource.Get( nSourceWhich ).Clone()); - ConvertItem( *pItem, eSourceUnit, eDestUnit ); + ConvertItem( pItem, eSourceUnit, eDestUnit ); pItem->SetWhich(nWhich); rDest.Put( *pItem ); } diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index 9d7ea22183e3..9f0e27909515 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -1225,7 +1225,7 @@ inline vcl::Cursor* ImpEditView::GetCursor() return pCursor.get(); } -void ConvertItem( SfxPoolItem& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit ); +void ConvertItem( std::unique_ptr<SfxPoolItem>& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit ); void ConvertAndPutItems( SfxItemSet& rDest, const SfxItemSet& rSource, const MapUnit* pSourceUnit = nullptr, const MapUnit* pDestUnit = nullptr ); AsianCompressionFlags GetCharTypeForCompression( sal_Unicode cChar ); Point Rotate( const Point& rPoint, short nOrientation, const Point& rOrigin ); diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 1838a063359e..79ac6acbc61d 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -1230,7 +1230,7 @@ EditSelection ImpEditEngine::InsertTextObject( const EditTextObject& rTextObject else { std::unique_ptr<SfxPoolItem> pNew(rX.GetItem()->Clone()); - ConvertItem( *pNew, eSourceUnit, eDestUnit ); + ConvertItem( pNew, eSourceUnit, eDestUnit ); pAttr = MakeCharAttrib( aEditDoc.GetItemPool(), *pNew, rX.GetStart()+nStartPos, rX.GetEnd()+nStartPos ); } DBG_ASSERT( pAttr->GetEnd() <= aPaM.GetNode()->Len(), "InsertBinTextObject: Attribute does not fit! (1)" ); diff --git a/editeng/source/items/bulitem.cxx b/editeng/source/items/bulitem.cxx index 04c844e99bdd..97c6f76457db 100644 --- a/editeng/source/items/bulitem.cxx +++ b/editeng/source/items/bulitem.cxx @@ -26,9 +26,6 @@ #include <tools/debug.hxx> #include <vcl/dibtools.hxx> -#define BULITEM_VERSION (sal_uInt16(2)) - - SvxBulletItem::SvxBulletItem( sal_uInt16 _nWhich ) : SfxPoolItem(_nWhich) , aFont(OutputDevice::GetDefaultFont( DefaultFontType::FIXED, LANGUAGE_SYSTEM, GetDefaultFontFlags::NONE )) @@ -69,12 +66,6 @@ SfxPoolItem* SvxBulletItem::Clone( SfxItemPool * /*pPool*/ ) const } -sal_uInt16 SvxBulletItem::GetVersion( sal_uInt16 /*nVersion*/ ) const -{ - return BULITEM_VERSION; -} - - void SvxBulletItem::CopyValidProperties( const SvxBulletItem& rCopyFrom ) { vcl::Font _aFont = GetFont(); diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index e384f8503d74..ac78520bdaa8 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -96,58 +96,6 @@ using namespace ::com::sun::star::drawing; using namespace ::com::sun::star::table::BorderLineStyle; -/* -SvxBorderLine is not an SfxPoolItem, and has no Store/Create serialization/deserialization methods. -Since border line information needs to be serialized by the table autoformat code, these file-local -methods are defined to encapsulate the necessary serialization logic. -*/ -namespace -{ - /// Item version for saved border lines. The old version saves the line without style information. - const int BORDER_LINE_OLD_VERSION = 0; - /// Item version for saved border lies. The new version includes line style. - const int BORDER_LINE_WITH_STYLE_VERSION = 1; - - /// Store a border line to a stream. - SvStream& StoreBorderLine(SvStream &stream, const SvxBorderLine &l, sal_uInt16 version) - { - WriteColor( stream, l.GetColor() ); - stream.WriteUInt16( l.GetOutWidth() ) - .WriteUInt16( l.GetInWidth() ) - .WriteUInt16( l.GetDistance() ); - - if (version >= BORDER_LINE_WITH_STYLE_VERSION) - stream.WriteUInt16( static_cast<sal_uInt16>(l.GetBorderLineStyle()) ); - - return stream; - } - - - /// Creates a border line from a stream. - SvxBorderLine CreateBorderLine(SvStream &stream, sal_uInt16 version) - { - sal_uInt16 nOutline, nInline, nDistance; - sal_uInt16 nStyle = css::table::BorderLineStyle::NONE; - Color aColor; - ReadColor( stream, aColor ).ReadUInt16( nOutline ).ReadUInt16( nInline ).ReadUInt16( nDistance ); - - if (version >= BORDER_LINE_WITH_STYLE_VERSION) - stream.ReadUInt16( nStyle ); - - SvxBorderLine border(&aColor); - border.GuessLinesWidths(static_cast<SvxBorderLineStyle>(nStyle), nOutline, nInline, nDistance); - return border; - } - - - /// Retrieves a BORDER_LINE_* version from a BOX_BORDER_* version. - sal_uInt16 BorderLineVersionFromBoxVersion(sal_uInt16 boxVersion) - { - return (boxVersion >= BOX_BORDER_STYLE_VERSION)? BORDER_LINE_WITH_STYLE_VERSION : BORDER_LINE_OLD_VERSION; - } -} - - SfxPoolItem* SvxPaperBinItem::CreateDefault() { return new SvxPaperBinItem(0);} SfxPoolItem* SvxSizeItem::CreateDefault() { return new SvxSizeItem(0);} SfxPoolItem* SvxLRSpaceItem::CreateDefault() { return new SvxLRSpaceItem(0);} @@ -647,14 +595,6 @@ bool SvxLRSpaceItem::GetPresentation } -sal_uInt16 SvxLRSpaceItem::GetVersion( sal_uInt16 nFileVersion ) const -{ - return (nFileVersion == SOFFICE_FILEFORMAT_31) - ? LRSPACE_TXTLEFT_VERSION - : LRSPACE_NEGATIVE_VERSION; -} - - void SvxLRSpaceItem::ScaleMetrics( long nMult, long nDiv ) { nFirstLineOfst = static_cast<short>(Scale( nFirstLineOfst, nMult, nDiv )); @@ -883,12 +823,6 @@ bool SvxULSpaceItem::GetPresentation } -sal_uInt16 SvxULSpaceItem::GetVersion( sal_uInt16 /*nFileVersion*/ ) const -{ - return ULSPACE_16_VERSION; -} - - void SvxULSpaceItem::ScaleMetrics( long nMult, long nDiv ) { nUpper = static_cast<sal_uInt16>(Scale( nUpper, nMult, nDiv )); @@ -1274,18 +1208,6 @@ bool SvxShadowItem::GetPresentation } -SvStream& SvxShadowItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const -{ - rStrm.WriteSChar( static_cast<sal_uInt8>(GetLocation()) ) - .WriteUInt16( GetWidth() ) - .WriteBool( aShadowColor.GetTransparency() > 0 ); - WriteColor( rStrm, GetColor() ); - WriteColor( rStrm, GetColor() ); - rStrm.WriteSChar( aShadowColor.GetTransparency() > 0 ? 0 : 1 ); //BRUSH_NULL : BRUSH_SOLID - return rStrm; -} - - void SvxShadowItem::ScaleMetrics( long nMult, long nDiv ) { nWidth = static_cast<sal_uInt16>(Scale( nWidth, nMult, nDiv )); @@ -1298,23 +1220,6 @@ bool SvxShadowItem::HasMetrics() const } -SfxPoolItem* SvxShadowItem::Create( SvStream& rStrm, sal_uInt16 ) const -{ - sal_Int8 cLoc; - sal_uInt16 _nWidth; - bool bTrans; - Color aColor; - Color aFillColor; - sal_Int8 nStyle; - rStrm.ReadSChar( cLoc ).ReadUInt16( _nWidth ) - .ReadCharAsBool( bTrans ); - ReadColor( rStrm, aColor ); - ReadColor( rStrm, aFillColor ).ReadSChar( nStyle ); - aColor.SetTransparency(bTrans ? 0xff : 0); - return new SvxShadowItem( Which(), &aColor, _nWidth, static_cast<SvxShadowLocation>(cLoc) ); -} - - sal_uInt16 SvxShadowItem::GetValueCount() const { return sal_uInt16(SvxShadowLocation::End); // SvxShadowLocation::BottomRight + 1 @@ -1376,21 +1281,6 @@ SvxBoxItem::~SvxBoxItem() } -SvxBoxItem& SvxBoxItem::operator=( const SvxBoxItem& rBox ) -{ - nTopDist = rBox.nTopDist; - nBottomDist = rBox.nBottomDist; - nLeftDist = rBox.nLeftDist; - nRightDist = rBox.nRightDist; - bRemoveAdjCellBorder = rBox.bRemoveAdjCellBorder; - SetLine( rBox.GetTop(), SvxBoxItemLine::TOP ); - SetLine( rBox.GetBottom(), SvxBoxItemLine::BOTTOM ); - SetLine( rBox.GetLeft(), SvxBoxItemLine::LEFT ); - SetLine( rBox.GetRight(), SvxBoxItemLine::RIGHT ); - return *this; -} - - static bool CmpBrdLn( const std::unique_ptr<SvxBorderLine> & pBrd1, const SvxBorderLine* pBrd2 ) { if( pBrd1.get() == pBrd2 ) @@ -1946,58 +1836,6 @@ bool SvxBoxItem::GetPresentation } -SvStream& SvxBoxItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const -{ - rStrm.WriteUInt16( GetSmallestDistance() ); - const SvxBorderLine* pLine[ 4 ]; // top, left, right, bottom - pLine[ 0 ] = GetTop(); - pLine[ 1 ] = GetLeft(); - pLine[ 2 ] = GetRight(); - pLine[ 3 ] = GetBottom(); - - for( int i = 0; i < 4; i++ ) - { - const SvxBorderLine* l = pLine[ i ]; - if( l ) - { - rStrm.WriteSChar(i); - StoreBorderLine(rStrm, *l, BorderLineVersionFromBoxVersion(nItemVersion)); - } - } - sal_Int8 cLine = 4; - if( nItemVersion >= BOX_4DISTS_VERSION && - !(nTopDist == nLeftDist && - nTopDist == nRightDist && - nTopDist == nBottomDist) ) - { - cLine |= 0x10; - } - - rStrm.WriteSChar( cLine ); - - if( nItemVersion >= BOX_4DISTS_VERSION && (cLine & 0x10) != 0 ) - { - rStrm.WriteUInt16( nTopDist ) - .WriteUInt16( nLeftDist ) - .WriteUInt16( nRightDist ) - .WriteUInt16( nBottomDist ); - } - - return rStrm; -} - - -sal_uInt16 SvxBoxItem::GetVersion( sal_uInt16 nFFVer ) const -{ - DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || - SOFFICE_FILEFORMAT_40==nFFVer || - SOFFICE_FILEFORMAT_50==nFFVer, - "SvxBoxItem: Is there a new file format?" ); - return SOFFICE_FILEFORMAT_31==nFFVer || - SOFFICE_FILEFORMAT_40==nFFVer ? 0 : BOX_BORDER_STYLE_VERSION; -} - - void SvxBoxItem::ScaleMetrics( long nMult, long nDiv ) { if ( pTop ) pTop->ScaleMetrics( nMult, nDiv ); @@ -2017,45 +1855,6 @@ bool SvxBoxItem::HasMetrics() const } -SfxPoolItem* SvxBoxItem::Create( SvStream& rStrm, sal_uInt16 nIVersion ) const -{ - sal_uInt16 nDistance; - rStrm.ReadUInt16( nDistance ); - SvxBoxItem* pAttr = new SvxBoxItem( Which() ); - - SvxBoxItemLine aLineMap[4] = { SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT, - SvxBoxItemLine::RIGHT, SvxBoxItemLine::BOTTOM }; - - sal_Int8 cLine(0); - while (rStrm.good()) - { - rStrm.ReadSChar( cLine ); - - if( cLine > 3 ) - break; - - SvxBorderLine aBorder = CreateBorderLine(rStrm, BorderLineVersionFromBoxVersion(nIVersion)); - pAttr->SetLine( &aBorder, aLineMap[cLine] ); - } - - if( nIVersion >= BOX_4DISTS_VERSION && (cLine&0x10) != 0 ) - { - for(SvxBoxItemLine & i : aLineMap) - { - sal_uInt16 nDist; - rStrm.ReadUInt16( nDist ); - pAttr->SetDistance( nDist, i ); - } - } - else - { - pAttr->SetAllDistances(nDistance); - } - - return pAttr; -} - - const SvxBorderLine *SvxBoxItem::GetLine( SvxBoxItemLine nLine ) const { const SvxBorderLine *pRet = nullptr; @@ -2269,22 +2068,6 @@ SvxBoxInfoItem::~SvxBoxInfoItem() { } -SvxBoxInfoItem &SvxBoxInfoItem::operator=( const SvxBoxInfoItem& rCpy ) -{ - if (this != &rCpy) - { - pHori.reset( rCpy.GetHori() ? new SvxBorderLine( *rCpy.GetHori() ) : nullptr ); - pVert.reset( rCpy.GetVert() ? new SvxBorderLine( *rCpy.GetVert() ) : nullptr ); - mbEnableHor = rCpy.mbEnableHor; - mbEnableVer = rCpy.mbEnableVer; - bDist = rCpy.IsDist(); - bMinDist = rCpy.IsMinDist(); - nValidFlags = rCpy.nValidFlags; - nDefDist = rCpy.GetDefDist(); - } - return *this; -} - bool SvxBoxInfoItem::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); @@ -2802,36 +2585,6 @@ SfxPoolItem* SvxFormatBreakItem::Clone( SfxItemPool* ) const } -SvStream& SvxFormatBreakItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const -{ - rStrm.WriteSChar( GetEnumValue() ); - if( FMTBREAK_NOAUTO > nItemVersion ) - rStrm.WriteSChar( 0x01 ); - return rStrm; -} - - -sal_uInt16 SvxFormatBreakItem::GetVersion( sal_uInt16 nFFVer ) const -{ - DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || - SOFFICE_FILEFORMAT_40==nFFVer || - SOFFICE_FILEFORMAT_50==nFFVer, - "SvxFormatBreakItem: Is there a new file format? "); - return SOFFICE_FILEFORMAT_31==nFFVer || - SOFFICE_FILEFORMAT_40==nFFVer ? 0 : FMTBREAK_NOAUTO; -} - - -SfxPoolItem* SvxFormatBreakItem::Create( SvStream& rStrm, sal_uInt16 nVersion ) const -{ - sal_Int8 eBreak, bDummy; - rStrm.ReadSChar( eBreak ); - if( FMTBREAK_NOAUTO > nVersion ) - rStrm.ReadSChar( bDummy ); - return new SvxFormatBreakItem( static_cast<SvxBreak>(eBreak), Which() ); -} - - sal_uInt16 SvxFormatBreakItem::GetValueCount() const { return sal_uInt16(SvxBreak::End); // SvxBreak::PageBoth + 1 @@ -2844,21 +2597,6 @@ SfxPoolItem* SvxFormatKeepItem::Clone( SfxItemPool* ) const } -SvStream& SvxFormatKeepItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const -{ - rStrm.WriteSChar( static_cast<sal_Int8>(GetValue()) ); - return rStrm; -} - - -SfxPoolItem* SvxFormatKeepItem::Create( SvStream& rStrm, sal_uInt16 ) const -{ - sal_Int8 bIsKeep; - rStrm.ReadSChar( bIsKeep ); - return new SvxFormatKeepItem( bIsKeep != 0, Which() ); -} - - bool SvxFormatKeepItem::GetPresentation ( SfxItemPresentation /*ePres*/, @@ -2894,14 +2632,6 @@ SvxLineItem::~SvxLineItem() } -SvxLineItem& SvxLineItem::operator=( const SvxLineItem& rLine ) -{ - SetLine( rLine.GetLine() ); - - return *this; -} - - bool SvxLineItem::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); @@ -3001,24 +2731,6 @@ bool SvxLineItem::GetPresentation } -SvStream& SvxLineItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const -{ - if( pLine ) - { - WriteColor( rStrm, pLine->GetColor() ); - rStrm.WriteInt16( pLine->GetOutWidth() ) - .WriteInt16( pLine->GetInWidth() ) - .WriteInt16( pLine->GetDistance() ); - } - else - { - WriteColor( rStrm, Color() ); - rStrm.WriteInt16( 0 ).WriteInt16( 0 ).WriteInt16( 0 ); - } - return rStrm; -} - - void SvxLineItem::ScaleMetrics( long nMult, long nDiv ) { if ( pLine ) pLine->ScaleMetrics( nMult, nDiv ); @@ -3031,31 +2743,11 @@ bool SvxLineItem::HasMetrics() const } -SfxPoolItem* SvxLineItem::Create( SvStream& rStrm, sal_uInt16 ) const -{ - SvxLineItem* _pLine = new SvxLineItem( Which() ); - short nOutline, nInline, nDistance; - Color aColor; - - ReadColor( rStrm, aColor ).ReadInt16( nOutline ).ReadInt16( nInline ).ReadInt16( nDistance ); - if( nOutline ) - { - SvxBorderLine aLine( &aColor ); - aLine.GuessLinesWidths(SvxBorderLineStyle::NONE, nOutline, nInline, nDistance); - _pLine->SetLine( &aLine ); - } - return _pLine; -} - void SvxLineItem::SetLine( const SvxBorderLine* pNew ) { pLine.reset( pNew ? new SvxBorderLine( *pNew ) : nullptr ); } -#define LOAD_GRAPHIC (sal_uInt16(0x0001)) -#define LOAD_LINK (sal_uInt16(0x0002)) -#define LOAD_FILTER (sal_uInt16(0x0004)) - SvxBrushItem::SvxBrushItem(sal_uInt16 _nWhich) : SfxPoolItem(_nWhich) , aColor(COL_TRANSPARENT) @@ -3114,115 +2806,6 @@ SvxBrushItem::SvxBrushItem(const OUString& rLink, const OUString& rFilter, DBG_ASSERT( GPOS_NONE != ePos, "SvxBrushItem-Ctor with GPOS_NONE == ePos" ); } -SvxBrushItem::SvxBrushItem(SvStream& rStream, sal_uInt16 nVersion, sal_uInt16 _nWhich) - : SfxPoolItem(_nWhich) - , aColor(COL_TRANSPARENT) - , nShadingValue(ShadingPattern::CLEAR) - , nGraphicTransparency(0) - , eGraphicPos(GPOS_NONE) - , bLoadAgain(false) -{ - bool bTrans; - Color aTempColor; - Color aTempFillColor; - sal_Int8 nStyle; - - rStream.ReadCharAsBool( bTrans ); - ReadColor( rStream, aTempColor ); - ReadColor( rStream, aTempFillColor ); - rStream.ReadSChar( nStyle ); - - switch ( nStyle ) - { - case 8: // BRUSH_25: - { - sal_uInt32 nRed = aTempColor.GetRed(); - sal_uInt32 nGreen = aTempColor.GetGreen(); - sal_uInt32 nBlue = aTempColor.GetBlue(); - nRed += static_cast<sal_uInt32>(aTempFillColor.GetRed())*2; - nGreen += static_cast<sal_uInt32>(aTempFillColor.GetGreen())*2; - nBlue += static_cast<sal_uInt32>(aTempFillColor.GetBlue())*2; - aColor = Color( static_cast<sal_Int8>(nRed/3), static_cast<sal_Int8>(nGreen/3), static_cast<sal_Int8>(nBlue/3) ); - } - break; - - case 9: // BRUSH_50: - { - sal_uInt32 nRed = aTempColor.GetRed(); - sal_uInt32 nGreen = aTempColor.GetGreen(); - sal_uInt32 nBlue = aTempColor.GetBlue(); - nRed += static_cast<sal_uInt32>(aTempFillColor.GetRed()); - nGreen += static_cast<sal_uInt32>(aTempFillColor.GetGreen()); - nBlue += static_cast<sal_uInt32>(aTempFillColor.GetBlue()); - aColor = Color( static_cast<sal_Int8>(nRed/2), static_cast<sal_Int8>(nGreen/2), static_cast<sal_Int8>(nBlue/2) ); - } - break; - - case 10: // BRUSH_75: - { - sal_uInt32 nRed = aTempColor.GetRed()*2; - sal_uInt32 nGreen = aTempColor.GetGreen()*2; - sal_uInt32 nBlue = aTempColor.GetBlue()*2; - nRed += static_cast<sal_uInt32>(aTempFillColor.GetRed()); - nGreen += static_cast<sal_uInt32>(aTempFillColor.GetGreen()); - nBlue += static_cast<sal_uInt32>(aTempFillColor.GetBlue()); - aColor = Color( static_cast<sal_Int8>(nRed/3), static_cast<sal_Int8>(nGreen/3), static_cast<sal_Int8>(nBlue/3) ); - } - break; - - case 0: // BRUSH_NULL: - aColor = COL_TRANSPARENT; - break; - - default: - aColor = aTempColor; - } - - if ( nVersion >= BRUSH_GRAPHIC_VERSION ) - { - sal_uInt16 nDoLoad = 0; - sal_Int8 nPos; - - rStream.ReadUInt16( nDoLoad ); - - if ( nDoLoad & LOAD_GRAPHIC ) - { - Graphic aGraphic; - - ReadGraphic( rStream, aGraphic ); - xGraphicObject.reset(new GraphicObject(aGraphic)); - - if( SVSTREAM_FILEFORMAT_ERROR == rStream.GetError() ) - { - rStream.ResetError(); - rStream.SetError( ERRCODE_SVX_GRAPHIC_WRONG_FILEFORMAT.MakeWarning() ); - } - } - - if ( nDoLoad & LOAD_LINK ) - { - // UNICODE: rStream >> aRel; - OUString aRel = rStream.ReadUniOrByteString(rStream.GetStreamCharSet()); - - // TODO/MBA: how can we get a BaseURL here?! - OSL_FAIL("No BaseURL!"); - OUString aAbs = INetURLObject::GetAbsURL( "", aRel ); - DBG_ASSERT( !aAbs.isEmpty(), "Invalid URL!" ); - maStrLink = aAbs; - } - - if ( nDoLoad & LOAD_FILTER ) - { - // UNICODE: rStream >> maStrFilter; - maStrFilter = rStream.ReadUniOrByteString(rStream.GetStreamCharSet()); - } - - rStream.ReadSChar( nPos ); - - eGraphicPos = static_cast<SvxGraphicPosition>(nPos); - } -} - SvxBrushItem::SvxBrushItem(const SvxBrushItem& rItem) : SfxPoolItem(rItem) , aColor(rItem.aColor) @@ -3269,11 +2852,6 @@ bool SvxBrushItem::isUsed() const return false; } -sal_uInt16 SvxBrushItem::GetVersion( sal_uInt16 /*nFileVersion*/ ) const -{ - return BRUSH_GRAPHIC_VERSION; -} - static sal_Int8 lcl_PercentToTransparency(long nPercent) { @@ -3498,35 +3076,6 @@ bool SvxBrushItem::GetPresentation return true; } -SvxBrushItem& SvxBrushItem::operator=(const SvxBrushItem& rItem) -{ - if (&rItem != this) - { - aColor = rItem.aColor; - nShadingValue = rItem.nShadingValue; - xGraphicObject.reset(rItem.xGraphicObject ? new GraphicObject(*rItem.xGraphicObject) : nullptr); - nGraphicTransparency = rItem.nGraphicTransparency; - maStrLink = rItem.maStrLink; - maStrFilter = rItem.maStrFilter; - eGraphicPos = rItem.eGraphicPos; - bLoadAgain = rItem.bLoadAgain; - } - return *this; -} - -SvxBrushItem& SvxBrushItem::operator=(SvxBrushItem&& rItem) -{ - aColor = std::move(rItem.aColor); - nShadingValue = std::move(rItem.nShadingValue); - xGraphicObject = std::move(rItem.xGraphicObject); - nGraphicTransparency = std::move(rItem.nGraphicTransparency); - maStrLink = std::move(rItem.maStrLink); - maStrFilter = std::move(rItem.maStrFilter); - eGraphicPos = std::move(rItem.eGraphicPos); - bLoadAgain = std::move(rItem.bLoadAgain); - return *this; -} - bool SvxBrushItem::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); @@ -3572,48 +3121,6 @@ SfxPoolItem* SvxBrushItem::Clone( SfxItemPool* ) const } -SfxPoolItem* SvxBrushItem::Create( SvStream& rStream, sal_uInt16 nVersion ) const -{ - return new SvxBrushItem( rStream, nVersion, Which() ); -} - - -SvStream& SvxBrushItem::Store( SvStream& rStream , sal_uInt16 /*nItemVersion*/ ) const -{ - rStream.WriteBool( false ); - WriteColor( rStream, aColor ); - WriteColor( rStream, aColor ); - rStream.WriteSChar( aColor.GetTransparency() > 0 ? 0 : 1 ); //BRUSH_NULL : BRUSH_SOLID - - sal_uInt16 nDoLoad = 0; - - if (xGraphicObject && maStrLink.isEmpty()) - nDoLoad |= LOAD_GRAPHIC; - if ( !maStrLink.isEmpty() ) - nDoLoad |= LOAD_LINK; - if ( !maStrFilter.isEmpty() ) - nDoLoad |= LOAD_FILTER; - rStream.WriteUInt16( nDoLoad ); - - if (xGraphicObject && maStrLink.isEmpty()) - WriteGraphic(rStream, xGraphicObject->GetGraphic()); - if ( !maStrLink.isEmpty() ) - { - OSL_FAIL("No BaseURL!"); - // TODO/MBA: how to get a BaseURL?! - OUString aRel = INetURLObject::GetRelURL( "", maStrLink ); - // UNICODE: rStream << aRel; - rStream.WriteUniOrByteString(aRel, rStream.GetStreamCharSet()); - } - if ( !maStrFilter.isEmpty() ) - { - // UNICODE: rStream << maStrFilter; - rStream.WriteUniOrByteString(maStrFilter, rStream.GetStreamCharSet()); - } - rStream.WriteSChar( eGraphicPos ); - return rStream; -} - const GraphicObject* SvxBrushItem::GetGraphicObject(OUString const & referer) const { if (bLoadAgain && !maStrLink.isEmpty() && !xGraphicObject) @@ -3812,18 +3319,6 @@ SfxPoolItem* SvxFrameDirectionItem::Clone( SfxItemPool * ) const } -SfxPoolItem* SvxFrameDirectionItem::Create( SvStream & rStrm, sal_uInt16 /*nVer*/ ) const -{ - sal_uInt16 nValue; - rStrm.ReadUInt16( nValue ); - return new SvxFrameDirectionItem( static_cast<SvxFrameDirection>(nValue), Which() ); -} - -sal_uInt16 SvxFrameDirectionItem::GetVersion( sal_uInt16 nFVer ) const -{ - return SOFFICE_FILEFORMAT_50 > nFVer ? USHRT_MAX : 0; -} - const char* getFrmDirResId(size_t nIndex) { const char* const RID_SVXITEMS_FRMDIR[] = diff --git a/editeng/source/items/justifyitem.cxx b/editeng/source/items/justifyitem.cxx index d010f72d58b1..1b9701356bdc 100644 --- a/editeng/source/items/justifyitem.cxx +++ b/editeng/source/items/justifyitem.cxx @@ -171,15 +171,6 @@ SfxPoolItem* SvxHorJustifyItem::Clone( SfxItemPool* ) const return new SvxHorJustifyItem( *this ); } - -SfxPoolItem* SvxHorJustifyItem::Create( SvStream& rStream, sal_uInt16 ) const -{ - sal_uInt16 nVal; - rStream.ReadUInt16( nVal ); - return new SvxHorJustifyItem( static_cast<SvxCellHorJustify>(nVal), Which() ); -} - - sal_uInt16 SvxHorJustifyItem::GetValueCount() const { return sal_uInt16(SvxCellHorJustify::Repeat) + 1; // Last Enum value + 1 @@ -308,14 +299,6 @@ SfxPoolItem* SvxVerJustifyItem::Clone( SfxItemPool* ) const } -SfxPoolItem* SvxVerJustifyItem::Create( SvStream& rStream, sal_uInt16 ) const -{ - sal_uInt16 nVal; - rStream.ReadUInt16( nVal ); - return new SvxVerJustifyItem( static_cast<SvxCellVerJustify>(nVal), Which() ); -} - - sal_uInt16 SvxVerJustifyItem::GetValueCount() const { return static_cast<sal_uInt16>(SvxCellVerJustify::Bottom) + 1; // Last Enum value + 1 diff --git a/editeng/source/items/legacyitem.cxx b/editeng/source/items/legacyitem.cxx new file mode 100755 index 000000000000..9a4acfafcead --- /dev/null +++ b/editeng/source/items/legacyitem.cxx @@ -0,0 +1,807 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <editeng/legacyitem.hxx> +#include <unotools/fontdefs.hxx> +#include <tools/tenccvt.hxx> +#include <tools/stream.hxx> +#include <comphelper/fileformat.h> +#include <vcl/graph.hxx> +#include <vcl/GraphicObject.hxx> +#include <osl/diagnose.h> +#include <tools/urlobj.hxx> +#include <editeng/fontitem.hxx> +#include <editeng/fhgtitem.hxx> +#include <editeng/wghtitem.hxx> +#include <editeng/postitem.hxx> +#include <editeng/udlnitem.hxx> +#include <editeng/crossedoutitem.hxx> +#include <editeng/colritem.hxx> +#include <editeng/boxitem.hxx> +#include <editeng/borderline.hxx> +#include <editeng/lineitem.hxx> +#include <editeng/brushitem.hxx> +#include <editeng/editerr.hxx> +#include <editeng/adjustitem.hxx> +#include <editeng/justifyitem.hxx> +#include <editeng/frmdiritem.hxx> +#include <editeng/formatbreakitem.hxx> +#include <editeng/keepitem.hxx> +#include <editeng/shaditem.hxx> + +void Create_legacy_direct_set(SvxFontHeightItem& rItem, sal_uInt32 nH, sal_uInt16 nP, MapUnit eP) +{ + rItem.legacy_direct_set(nH, nP, eP); +} + +namespace legacy +{ + namespace SvxFont + { + sal_uInt16 GetVersion(sal_uInt16) + { + return 0; + } + + void Create(SvxFontItem& rItem, SvStream& rStrm, sal_uInt16) + { + sal_uInt8 _eFamily, eFontPitch, eFontTextEncoding; + OUString aName, aStyle; + rStrm.ReadUChar( _eFamily ); + rStrm.ReadUChar( eFontPitch ); + rStrm.ReadUChar( eFontTextEncoding ); + + // UNICODE: rStrm >> aName; + aName = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet()); + + // UNICODE: rStrm >> aStyle; + aStyle = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet()); + + // Set the "correct" textencoding + eFontTextEncoding = static_cast<sal_uInt8>(GetSOLoadTextEncoding( eFontTextEncoding )); + + // at some point, the StarBats changes from ANSI font to SYMBOL font + if ( RTL_TEXTENCODING_SYMBOL != eFontTextEncoding && aName == "StarBats" ) + eFontTextEncoding = RTL_TEXTENCODING_SYMBOL; + + // Check if we have stored unicode + sal_uInt64 const nStreamPos = rStrm.Tell(); + // #define STORE_UNICODE_MAGIC_MARKER 0xFE331188 + sal_uInt32 nMagic = 0xFE331188; + rStrm.ReadUInt32( nMagic ); + if ( nMagic == 0xFE331188 ) + { + aName = rStrm.ReadUniOrByteString( RTL_TEXTENCODING_UNICODE ); + aStyle = rStrm.ReadUniOrByteString( RTL_TEXTENCODING_UNICODE ); + } + else + { + rStrm.Seek( nStreamPos ); + } + + rItem.SetFamilyName(aName); + rItem.SetStyleName(aStyle); + rItem.SetFamily(static_cast<FontFamily>(_eFamily)); + rItem.SetPitch(static_cast<FontPitch>(eFontPitch)); + rItem.SetCharSet(static_cast<rtl_TextEncoding>(eFontTextEncoding)); + } + + SvStream& Store(const SvxFontItem& rItem, SvStream& rStrm, sal_uInt16) + { + const bool bToBats(IsStarSymbol(rItem.GetFamilyName())); + + rStrm.WriteUChar(rItem.GetFamily()).WriteUChar(rItem.GetPitch()).WriteUChar(bToBats ? + RTL_TEXTENCODING_SYMBOL : + GetSOStoreTextEncoding(rItem.GetCharSet())); + + const OUString aStoreFamilyName(bToBats ? "StarBats" : rItem.GetFamilyName()); + + rStrm.WriteUniOrByteString(aStoreFamilyName, rStrm.GetStreamCharSet()); + rStrm.WriteUniOrByteString(rItem.GetStyleName(), rStrm.GetStreamCharSet()); + + return rStrm; + } + } + + namespace SvxFontHeight + { + sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion) + { + return (nFileFormatVersion <= SOFFICE_FILEFORMAT_40) + ? FONTHEIGHT_16_VERSION + : FONTHEIGHT_UNIT_VERSION; + } + + void Create(SvxFontHeightItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion) + { + sal_uInt16 nsize, nprop = 0; + MapUnit nPropUnit = MapUnit::MapRelative; + + rStrm.ReadUInt16( nsize ); + + if( FONTHEIGHT_16_VERSION <= nItemVersion ) + rStrm.ReadUInt16( nprop ); + else + { + sal_uInt8 nP; + rStrm .ReadUChar( nP ); + nprop = static_cast<sal_uInt16>(nP); + } + + if( FONTHEIGHT_UNIT_VERSION <= nItemVersion ) + { + sal_uInt16 nTmp; + rStrm.ReadUInt16( nTmp ); + nPropUnit = static_cast<MapUnit>(nTmp); + } + + Create_legacy_direct_set(rItem, nsize, nprop, nPropUnit); + } + + SvStream& Store(const SvxFontHeightItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion) + { + rStrm.WriteUInt16( rItem.GetHeight() ); + + if( FONTHEIGHT_UNIT_VERSION <= nItemVersion ) + rStrm.WriteUInt16( rItem.GetProp() ).WriteUInt16( static_cast<sal_uInt16>(rItem.GetPropUnit()) ); + else + { + // When exporting to the old versions the relative information is lost + // when there is no percentage + sal_uInt16 _nProp = rItem.GetProp(); + if( MapUnit::MapRelative != rItem.GetPropUnit() ) + _nProp = 100; + rStrm.WriteUInt16( _nProp ); + } + return rStrm; + } + } + + namespace SvxWeight + { + sal_uInt16 GetVersion(sal_uInt16) + { + return 0; + } + + void Create(SvxWeightItem& rItem, SvStream& rStrm, sal_uInt16) + { + sal_uInt8 nWeight(0); + rStrm.ReadUChar(nWeight); + rItem.SetValue(static_cast<FontWeight>(nWeight)); + } + + SvStream& Store(const SvxWeightItem& rItem, SvStream& rStrm, sal_uInt16) + { + rStrm.WriteUChar(rItem.GetValue()); + return rStrm; + } + } + + namespace SvxPosture + { + sal_uInt16 GetVersion(sal_uInt16) + { + return 0; + } + + void Create(SvxPostureItem& rItem, SvStream& rStrm, sal_uInt16) + { + sal_uInt8 nPosture(0); + rStrm.ReadUChar(nPosture); + rItem.SetValue(static_cast<FontItalic>(nPosture)); + } + + SvStream& Store(const SvxPostureItem& rItem, SvStream& rStrm, sal_uInt16) + { + rStrm.WriteUChar( rItem.GetValue() ); + return rStrm; + } + } + + namespace SvxTextLine // SvxUnderlineItem, SvxOverlineItem -> SvxTextLineItem + { + sal_uInt16 GetVersion(sal_uInt16) + { + return 0; + } + + void Create(SvxTextLineItem& rItem, SvStream& rStrm, sal_uInt16) + { + sal_uInt8 nState(0); + rStrm.ReadUChar(nState); + rItem.SetValue(static_cast<FontLineStyle>(nState)); + // GetColor() is *not* saved/loaded ?!? + } + + SvStream& Store(const SvxTextLineItem& rItem, SvStream& rStrm, sal_uInt16) + { + rStrm.WriteUChar(rItem.GetValue()); + // GetColor() is *not* saved/loaded ?!? + return rStrm; + } + } + + namespace SvxCrossedOut + { + sal_uInt16 GetVersion(sal_uInt16) + { + return 0; + } + + void Create(SvxCrossedOutItem& rItem, SvStream& rStrm, sal_uInt16) + { + sal_uInt8 eCross(0); + rStrm.ReadUChar(eCross); + rItem.SetValue(static_cast<FontStrikeout>(eCross)); + } + + SvStream& Store(const SvxCrossedOutItem& rItem, SvStream& rStrm, sal_uInt16) + { + rStrm.WriteUChar(rItem.GetValue()); + return rStrm; + } + } + + namespace SvxColor + { + sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion) + { + DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFileFormatVersion || + SOFFICE_FILEFORMAT_40==nFileFormatVersion || + SOFFICE_FILEFORMAT_50==nFileFormatVersion, + "SvxColorItem: Is there a new file format? "); + return SOFFICE_FILEFORMAT_50 >= nFileFormatVersion ? VERSION_USEAUTOCOLOR : 0; + } + + void Create(SvxColorItem& rItem, SvStream& rStrm, sal_uInt16) + { + Color aColor(COL_AUTO); + ReadColor(rStrm, aColor); + rItem.SetValue(aColor); + } + + SvStream& Store(const SvxColorItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion) + { + if( VERSION_USEAUTOCOLOR == nItemVersion && COL_AUTO == rItem.GetValue() ) + WriteColor( rStrm, COL_BLACK ); + else + WriteColor( rStrm, rItem.GetValue() ); + return rStrm; + } + } + + namespace SvxBox + { + sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion) + { + DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFileFormatVersion || + SOFFICE_FILEFORMAT_40==nFileFormatVersion || + SOFFICE_FILEFORMAT_50==nFileFormatVersion, + "SvxBoxItem: Is there a new file format?" ); + return SOFFICE_FILEFORMAT_31==nFileFormatVersion || + SOFFICE_FILEFORMAT_40==nFileFormatVersion ? 0 : BOX_BORDER_STYLE_VERSION; + } + + /// Item version for saved border lines. The old version saves the line without style information. + const int BORDER_LINE_OLD_VERSION = 0; + /// Item version for saved border lies. The new version includes line style. + const int BORDER_LINE_WITH_STYLE_VERSION = 1; + + /// Creates a border line from a stream. + static ::editeng::SvxBorderLine CreateBorderLine(SvStream &stream, sal_uInt16 version) + { + sal_uInt16 nOutline, nInline, nDistance; + sal_uInt16 nStyle = css::table::BorderLineStyle::NONE; + Color aColor; + ReadColor( stream, aColor ).ReadUInt16( nOutline ).ReadUInt16( nInline ).ReadUInt16( nDistance ); + + if (version >= BORDER_LINE_WITH_STYLE_VERSION) + stream.ReadUInt16( nStyle ); + + ::editeng::SvxBorderLine border(&aColor); + border.GuessLinesWidths(static_cast<SvxBorderLineStyle>(nStyle), nOutline, nInline, nDistance); + return border; + } + + /// Retrieves a BORDER_LINE_* version from a BOX_BORDER_* version. + static sal_uInt16 BorderLineVersionFromBoxVersion(sal_uInt16 boxVersion) + { + return (boxVersion >= BOX_BORDER_STYLE_VERSION)? BORDER_LINE_WITH_STYLE_VERSION : BORDER_LINE_OLD_VERSION; + } + + void Create(SvxBoxItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion) + { + sal_uInt16 nDistance(0); + rStrm.ReadUInt16( nDistance ); + SvxBoxItemLine aLineMap[4] = { SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT, + SvxBoxItemLine::RIGHT, SvxBoxItemLine::BOTTOM }; + sal_Int8 cLine(0); + + while (rStrm.good()) + { + rStrm.ReadSChar( cLine ); + + if( cLine > 3 ) + break; + + ::editeng::SvxBorderLine aBorder = CreateBorderLine(rStrm, BorderLineVersionFromBoxVersion(nItemVersion)); + rItem.SetLine( &aBorder, aLineMap[cLine] ); + } + + if( nItemVersion >= BOX_4DISTS_VERSION && (cLine&0x10) != 0 ) + { + for(SvxBoxItemLine & i : aLineMap) + { + sal_uInt16 nDist; + rStrm.ReadUInt16( nDist ); + rItem.SetDistance( nDist, i ); + } + } + else + { + rItem.SetAllDistances(nDistance); + } + } + + /// Store a border line to a stream. + static SvStream& StoreBorderLine(SvStream &stream, const ::editeng::SvxBorderLine &l, sal_uInt16 version) + { + WriteColor( stream, l.GetColor() ); + stream.WriteUInt16( l.GetOutWidth() ) + .WriteUInt16( l.GetInWidth() ) + .WriteUInt16( l.GetDistance() ); + + if (version >= BORDER_LINE_WITH_STYLE_VERSION) + stream.WriteUInt16( static_cast<sal_uInt16>(l.GetBorderLineStyle()) ); + + return stream; + } + + SvStream& Store(const SvxBoxItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion) + { + rStrm.WriteUInt16( rItem.GetSmallestDistance() ); + const ::editeng::SvxBorderLine* pLine[ 4 ]; // top, left, right, bottom + pLine[ 0 ] = rItem.GetTop(); + pLine[ 1 ] = rItem.GetLeft(); + pLine[ 2 ] = rItem.GetRight(); + pLine[ 3 ] = rItem.GetBottom(); + + for( int i = 0; i < 4; i++ ) + { + const ::editeng::SvxBorderLine* l = pLine[ i ]; + if( l ) + { + rStrm.WriteSChar(i); + StoreBorderLine(rStrm, *l, BorderLineVersionFromBoxVersion(nItemVersion)); + } + } + sal_Int8 cLine = 4; + const sal_uInt16 nTopDist(rItem.GetDistance(SvxBoxItemLine::TOP)); + const sal_uInt16 nLeftDist(rItem.GetDistance(SvxBoxItemLine::LEFT)); + const sal_uInt16 nRightDist(rItem.GetDistance(SvxBoxItemLine::RIGHT)); + const sal_uInt16 nBottomDist(rItem.GetDistance(SvxBoxItemLine::BOTTOM)); + + if( nItemVersion >= BOX_4DISTS_VERSION && + !(nTopDist == nLeftDist && + nTopDist == nRightDist && + nTopDist == nBottomDist) ) + { + cLine |= 0x10; + } + + rStrm.WriteSChar( cLine ); + + if( nItemVersion >= BOX_4DISTS_VERSION && (cLine & 0x10) != 0 ) + { + rStrm.WriteUInt16( nTopDist ) + .WriteUInt16( nLeftDist ) + .WriteUInt16( nRightDist ) + .WriteUInt16( nBottomDist ); + } + + return rStrm; + } + } + + namespace SvxLine + { + sal_uInt16 GetVersion(sal_uInt16) + { + return 0; + } + + void Create(SvxLineItem& rItem, SvStream& rStrm, sal_uInt16) + { + short nOutline, nInline, nDistance; + Color aColor; + + ReadColor( rStrm, aColor ).ReadInt16( nOutline ).ReadInt16( nInline ).ReadInt16( nDistance ); + if( nOutline ) + { + ::editeng::SvxBorderLine aLine( &aColor ); + aLine.GuessLinesWidths(SvxBorderLineStyle::NONE, nOutline, nInline, nDistance); + rItem.SetLine( &aLine ); + } + } + + SvStream& Store(const SvxLineItem& rItem, SvStream& rStrm, sal_uInt16) + { + const ::editeng::SvxBorderLine* pLine(rItem.GetLine()); + + if(nullptr != pLine) + { + WriteColor( rStrm, pLine->GetColor() ); + rStrm.WriteInt16( pLine->GetOutWidth() ) + .WriteInt16( pLine->GetInWidth() ) + .WriteInt16( pLine->GetDistance() ); + } + else + { + WriteColor( rStrm, Color() ); + rStrm.WriteInt16( 0 ).WriteInt16( 0 ).WriteInt16( 0 ); + } + + return rStrm; + } + } + + namespace SvxBrush + { + sal_uInt16 GetVersion(sal_uInt16) + { + return BRUSH_GRAPHIC_VERSION; + } + + const sal_uInt16 LOAD_GRAPHIC = (sal_uInt16(0x0001)); + const sal_uInt16 LOAD_LINK = (sal_uInt16(0x0002)); + const sal_uInt16 LOAD_FILTER = (sal_uInt16(0x0004)); + + void Create(SvxBrushItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion) + { + bool bTrans; + Color aTempColor; + Color aTempFillColor; + sal_Int8 nStyle; + + rStrm.ReadCharAsBool( bTrans ); + ReadColor( rStrm, aTempColor ); + ReadColor( rStrm, aTempFillColor ); + rStrm.ReadSChar( nStyle ); + + switch ( nStyle ) + { + case 8: // BRUSH_25: + { + sal_uInt32 nRed = aTempColor.GetRed(); + sal_uInt32 nGreen = aTempColor.GetGreen(); + sal_uInt32 nBlue = aTempColor.GetBlue(); + nRed += static_cast<sal_uInt32>(aTempFillColor.GetRed())*2; + nGreen += static_cast<sal_uInt32>(aTempFillColor.GetGreen())*2; + nBlue += static_cast<sal_uInt32>(aTempFillColor.GetBlue())*2; + rItem.SetColor(Color( static_cast<sal_Int8>(nRed/3), static_cast<sal_Int8>(nGreen/3), static_cast<sal_Int8>(nBlue/3) )); + } + break; + + case 9: // BRUSH_50: + { + sal_uInt32 nRed = aTempColor.GetRed(); + sal_uInt32 nGreen = aTempColor.GetGreen(); + sal_uInt32 nBlue = aTempColor.GetBlue(); + nRed += static_cast<sal_uInt32>(aTempFillColor.GetRed()); + nGreen += static_cast<sal_uInt32>(aTempFillColor.GetGreen()); + nBlue += static_cast<sal_uInt32>(aTempFillColor.GetBlue()); + rItem.SetColor(Color( static_cast<sal_Int8>(nRed/2), static_cast<sal_Int8>(nGreen/2), static_cast<sal_Int8>(nBlue/2) )); + } + break; + + case 10: // BRUSH_75: + { + sal_uInt32 nRed = aTempColor.GetRed()*2; + sal_uInt32 nGreen = aTempColor.GetGreen()*2; + sal_uInt32 nBlue = aTempColor.GetBlue()*2; + nRed += static_cast<sal_uInt32>(aTempFillColor.GetRed()); + nGreen += static_cast<sal_uInt32>(aTempFillColor.GetGreen()); + nBlue += static_cast<sal_uInt32>(aTempFillColor.GetBlue()); + rItem.SetColor(Color( static_cast<sal_Int8>(nRed/3), static_cast<sal_Int8>(nGreen/3), static_cast<sal_Int8>(nBlue/3) )); + } + break; + + case 0: // BRUSH_NULL: + rItem.SetColor(COL_TRANSPARENT); + break; + + default: + rItem.SetColor(aTempColor); + } + + if ( nItemVersion >= BRUSH_GRAPHIC_VERSION ) + { + sal_uInt16 nDoLoad = 0; + sal_Int8 nPos; + + rStrm.ReadUInt16( nDoLoad ); + + if ( nDoLoad & LOAD_GRAPHIC ) + { + Graphic aGraphic; + + ReadGraphic( rStrm, aGraphic ); + rItem.SetGraphicObject(GraphicObject(aGraphic)); + + if( SVSTREAM_FILEFORMAT_ERROR == rStrm.GetError() ) + { + rStrm.ResetError(); + rStrm.SetError( ERRCODE_SVX_GRAPHIC_WRONG_FILEFORMAT.MakeWarning() ); + } + } + + if ( nDoLoad & LOAD_LINK ) + { + // UNICODE: rStrm >> aRel; + OUString aRel = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet()); + + // TODO/MBA: how can we get a BaseURL here?! + OSL_FAIL("No BaseURL!"); + OUString aAbs = INetURLObject::GetAbsURL( "", aRel ); + DBG_ASSERT( !aAbs.isEmpty(), "Invalid URL!" ); + rItem.SetGraphicLink(aAbs); + } + + if ( nDoLoad & LOAD_FILTER ) + { + // UNICODE: rStrm >> maStrFilter; + rItem.SetGraphicFilter(rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet())); + } + + rStrm.ReadSChar( nPos ); + + rItem.SetGraphicPos(static_cast<SvxGraphicPosition>(nPos)); + } + } + + SvStream& Store(const SvxBrushItem& rItem, SvStream& rStrm, sal_uInt16) + { + rStrm.WriteBool( false ); + WriteColor( rStrm, rItem.GetColor() ); + WriteColor( rStrm, rItem.GetColor() ); + rStrm.WriteSChar( rItem.GetColor().GetTransparency() > 0 ? 0 : 1 ); //BRUSH_NULL : BRUSH_SOLID + + sal_uInt16 nDoLoad = 0; + const GraphicObject* pGraphicObject(rItem.GetGraphicObject()); + + if (nullptr != pGraphicObject && rItem.GetGraphicLink().isEmpty()) + nDoLoad |= LOAD_GRAPHIC; + if ( !rItem.GetGraphicLink().isEmpty() ) + nDoLoad |= LOAD_LINK; + if ( !rItem.GetGraphicFilter().isEmpty() ) + nDoLoad |= LOAD_FILTER; + rStrm.WriteUInt16( nDoLoad ); + + if (nullptr != pGraphicObject && rItem.GetGraphicLink().isEmpty()) + WriteGraphic(rStrm, pGraphicObject->GetGraphic()); + if ( !rItem.GetGraphicLink().isEmpty() ) + { + OSL_FAIL("No BaseURL!"); + // TODO/MBA: how to get a BaseURL?! + OUString aRel = INetURLObject::GetRelURL( "", rItem.GetGraphicLink() ); + // UNICODE: rStrm << aRel; + rStrm.WriteUniOrByteString(aRel, rStrm.GetStreamCharSet()); + } + if ( !rItem.GetGraphicFilter().isEmpty() ) + { + // UNICODE: rStrm << rItem.GetGraphicFilter(); + rStrm.WriteUniOrByteString(rItem.GetGraphicFilter(), rStrm.GetStreamCharSet()); + } + rStrm.WriteSChar( rItem.GetGraphicPos() ); + return rStrm; + } + } + + namespace SvxAdjust + { + sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion) + { + return (nFileFormatVersion == SOFFICE_FILEFORMAT_31) + ? 0 : ADJUST_LASTBLOCK_VERSION; + } + + void Create(SvxAdjustItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion) + { + char eAdjustment; + rStrm.ReadChar(eAdjustment); + rItem.SetAdjust(static_cast<::SvxAdjust>(eAdjustment)); + + if( nItemVersion >= ADJUST_LASTBLOCK_VERSION ) + { + sal_Int8 nFlags; + rStrm.ReadSChar( nFlags ); + rItem.SetAsFlags(nFlags); + } + } + + SvStream& Store(const SvxAdjustItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion) + { + rStrm.WriteChar( static_cast<char>(rItem.GetAdjust()) ); + if ( nItemVersion >= ADJUST_LASTBLOCK_VERSION ) + { + const sal_Int8 nFlags(rItem.GetAsFlags()); + rStrm.WriteSChar( nFlags ); + } + return rStrm; + } + } + + namespace SvxHorJustify + { + sal_uInt16 GetVersion(sal_uInt16) + { + return 0; + } + + void Create(SvxHorJustifyItem& rItem, SvStream& rStrm, sal_uInt16) + { + sal_uInt16 nVal(0); + rStrm.ReadUInt16( nVal ); + rItem.SetValue(static_cast<::SvxCellHorJustify>(nVal)); + } + + SvStream& Store(const SvxHorJustifyItem& rItem, SvStream& rStrm, sal_uInt16) + { + rStrm.WriteUInt16( static_cast<sal_uInt16>(rItem.GetValue()) ); + return rStrm; + } + } + + namespace SvxVerJustify + { + sal_uInt16 GetVersion(sal_uInt16) + { + return 0; + } + + void Create(SvxVerJustifyItem& rItem, SvStream& rStrm, sal_uInt16) + { + sal_uInt16 nVal(0); + rStrm.ReadUInt16( nVal ); + rItem.SetValue(static_cast<::SvxCellVerJustify>(nVal)); + } + + SvStream& Store(const SvxVerJustifyItem& rItem, SvStream& rStrm, sal_uInt16) + { + rStrm.WriteUInt16( static_cast<sal_uInt16>(rItem.GetValue()) ); + return rStrm; + } + } + + namespace SvxFrameDirection + { + sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion) + { + return SOFFICE_FILEFORMAT_50 > nFileFormatVersion ? USHRT_MAX : 0; + } + + void Create(SvxFrameDirectionItem& rItem, SvStream& rStrm, sal_uInt16) + { + sal_uInt16 nVal(0); + rStrm.ReadUInt16( nVal ); + rItem.SetValue(static_cast<::SvxFrameDirection>(nVal)); + } + + SvStream& Store(const SvxFrameDirectionItem& rItem, SvStream& rStrm, sal_uInt16) + { + rStrm.WriteUInt16( static_cast<sal_uInt16>(rItem.GetValue()) ); + return rStrm; + } + } + + namespace SvxFormatBreak + { + sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion) + { + DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFileFormatVersion || + SOFFICE_FILEFORMAT_40==nFileFormatVersion || + SOFFICE_FILEFORMAT_50==nFileFormatVersion, + "SvxFormatBreakItem: Is there a new file format? "); + return SOFFICE_FILEFORMAT_31==nFileFormatVersion || + SOFFICE_FILEFORMAT_40==nFileFormatVersion ? 0 : FMTBREAK_NOAUTO; + } + + void Create(SvxFormatBreakItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion) + { + sal_Int8 eBreak, bDummy; + rStrm.ReadSChar( eBreak ); + if( FMTBREAK_NOAUTO > nItemVersion ) + rStrm.ReadSChar( bDummy ); + rItem.SetValue(static_cast<::SvxBreak>(eBreak)); + } + + SvStream& Store(const SvxFormatBreakItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion) + { + rStrm.WriteSChar( rItem.GetEnumValue() ); + if( FMTBREAK_NOAUTO > nItemVersion ) + rStrm.WriteSChar( 0x01 ); + return rStrm; + } + } + + namespace SvxFormatKeep + { + sal_uInt16 GetVersion(sal_uInt16) + { + return 0; + } + + void Create(SvxFormatKeepItem& rItem, SvStream& rStrm, sal_uInt16) + { + // derived from SfxBoolItem, but that uses + // rStream.ReadCharAsBool( tmp ); + sal_Int8 bIsKeep; + rStrm.ReadSChar( bIsKeep ); + rItem.SetValue(static_cast<bool>(bIsKeep)); + } + + SvStream& Store(const SvxFormatKeepItem& rItem, SvStream& rStrm, sal_uInt16) + { + // derived from SfxBoolItem, but that uses + // rStream.WriteBool( m_bValue ); // not bool for serialization! + rStrm.WriteSChar( static_cast<sal_Int8>(rItem.GetValue()) ); + return rStrm; + } + } + + namespace SvxShadow + { + sal_uInt16 GetVersion(sal_uInt16) + { + return 0; + } + + void Create(SvxShadowItem& rItem, SvStream& rStrm, sal_uInt16) + { + sal_Int8 cLoc; + sal_uInt16 _nWidth; + bool bTrans; + Color aColor; + Color aFillColor; + sal_Int8 nStyle; + rStrm.ReadSChar( cLoc ).ReadUInt16( _nWidth ).ReadCharAsBool( bTrans ); + ReadColor( rStrm, aColor ); + ReadColor( rStrm, aFillColor ).ReadSChar( nStyle ); + aColor.SetTransparency(bTrans ? 0xff : 0); + + rItem.SetLocation(static_cast<SvxShadowLocation>(cLoc)); + rItem.SetWidth(_nWidth); + rItem.SetColor(aColor); + } + + SvStream& Store(const SvxShadowItem& rItem, SvStream& rStrm, sal_uInt16) + { + rStrm.WriteSChar( static_cast<sal_uInt8>(rItem.GetLocation()) ) + .WriteUInt16( rItem.GetWidth() ) + .WriteBool( rItem.GetColor().GetTransparency() > 0 ); + WriteColor( rStrm, rItem.GetColor() ); + WriteColor( rStrm, rItem.GetColor() ); + rStrm.WriteSChar( rItem.GetColor().GetTransparency() > 0 ? 0 : 1 ); //BRUSH_NULL : BRUSH_SOLID + return rStrm; + } + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index ddb1aa11926f..5a748f5a4414 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -53,6 +53,7 @@ #include <editeng/unonrule.hxx> #include <sal/log.hxx> #include <i18nlangtag/languagetag.hxx> +#include <editeng/legacyitem.hxx> #define DEF_WRITER_LSPACE 500 //Standard Indentation #define DEF_DRAW_LSPACE 800 //Standard Indentation @@ -217,8 +218,8 @@ SvxNumberFormat::SvxNumberFormat( SvStream &rStream ) rStream.ReadUInt16( hasGraphicBrush ); if ( hasGraphicBrush ) { - std::unique_ptr<SvxBrushItem> pTmp( new SvxBrushItem( SID_ATTR_BRUSH ) ); - pGraphicBrush.reset( static_cast<SvxBrushItem*>(pTmp->Create( rStream, BRUSH_GRAPHIC_VERSION )) ); + pGraphicBrush.reset(new SvxBrushItem(SID_ATTR_BRUSH)); + legacy::SvxBrush::Create(*pGraphicBrush, rStream, BRUSH_GRAPHIC_VERSION); } else pGraphicBrush = nullptr; rStream.ReadUInt16( nTmp16 ); eVertOrient = nTmp16; @@ -290,7 +291,7 @@ void SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pConverte pGraphicBrush->SetGraphicLink(""); } - pGraphicBrush->Store(rStream, BRUSH_GRAPHIC_VERSION); + legacy::SvxBrush::Store(*pGraphicBrush, rStream, BRUSH_GRAPHIC_VERSION); } else rStream.WriteUInt16( 0 ); @@ -939,11 +940,6 @@ SfxPoolItem* SvxNumBulletItem::Clone( SfxItemPool * ) const return new SvxNumBulletItem(*this); } -sal_uInt16 SvxNumBulletItem::GetVersion( sal_uInt16 /*nFileVersion*/ ) const -{ - return NUMITEM_VERSION_03; -} - bool SvxNumBulletItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const { rVal <<= SvxCreateNumRule( pNumRule.get() ); diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx index 3bd1449b7c0e..4cf9750f15ca 100644 --- a/editeng/source/items/paraitem.cxx +++ b/editeng/source/items/paraitem.cxx @@ -401,47 +401,6 @@ void SvxAdjustItem::SetEnumValue( sal_uInt16 nVal ) } -sal_uInt16 SvxAdjustItem::GetVersion( sal_uInt16 nFileVersion ) const -{ - return (nFileVersion == SOFFICE_FILEFORMAT_31) - ? 0 : ADJUST_LASTBLOCK_VERSION; -} - - -SfxPoolItem* SvxAdjustItem::Create(SvStream& rStrm, sal_uInt16 nVersion) const -{ - char eAdjustment; - rStrm.ReadChar( eAdjustment ); - SvxAdjustItem *pRet = new SvxAdjustItem( static_cast<SvxAdjust>(eAdjustment), Which() ); - if( nVersion >= ADJUST_LASTBLOCK_VERSION ) - { - sal_Int8 nFlags; - rStrm.ReadSChar( nFlags ); - pRet->bOneBlock = 0 != (nFlags & 0x0001); - pRet->bLastCenter = 0 != (nFlags & 0x0002); - pRet->bLastBlock = 0 != (nFlags & 0x0004); - } - return pRet; -} - - -SvStream& SvxAdjustItem::Store( SvStream& rStrm, sal_uInt16 nItemVersion ) const -{ - rStrm.WriteChar( static_cast<char>(GetAdjust()) ); - if ( nItemVersion >= ADJUST_LASTBLOCK_VERSION ) - { - sal_Int8 nFlags = 0; - if ( bOneBlock ) - nFlags |= 0x0001; - if ( bLastCenter ) - nFlags |= 0x0002; - if ( bLastBlock ) - nFlags |= 0x0004; - rStrm.WriteSChar( nFlags ); - } - return rStrm; -} - // class SvxWidowsItem --------------------------------------------------- SvxWidowsItem::SvxWidowsItem(const sal_uInt8 nL, const sal_uInt16 nId ) : @@ -752,12 +711,6 @@ sal_uInt16 SvxTabStopItem::GetPos( const sal_Int32 nPos ) const } -SvxTabStopItem& SvxTabStopItem::operator=( const SvxTabStopItem& rTSI ) -{ - maTabStops = rTSI.maTabStops; - return *this; -} - bool SvxTabStopItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); @@ -1090,16 +1043,6 @@ SfxPoolItem* SvxScriptSpaceItem::Clone( SfxItemPool * ) const return new SvxScriptSpaceItem( *this ); } -sal_uInt16 SvxScriptSpaceItem::GetVersion( sal_uInt16 nFFVer ) const -{ - DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || - SOFFICE_FILEFORMAT_40==nFFVer || - SOFFICE_FILEFORMAT_50==nFFVer, - "SvxTwoLinesItem: Is there a new file format? "); - - return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; -} - bool SvxScriptSpaceItem::GetPresentation( SfxItemPresentation /*ePres*/, MapUnit /*eCoreMetric*/, MapUnit /*ePresMetric*/, @@ -1123,16 +1066,6 @@ SfxPoolItem* SvxHangingPunctuationItem::Clone( SfxItemPool * ) const return new SvxHangingPunctuationItem( *this ); } -sal_uInt16 SvxHangingPunctuationItem::GetVersion( sal_uInt16 nFFVer ) const -{ - DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || - SOFFICE_FILEFORMAT_40==nFFVer || - SOFFICE_FILEFORMAT_50==nFFVer, - "SvxHangingPunctuationItem: Is there a new file format? "); - - return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; -} - bool SvxHangingPunctuationItem::GetPresentation( SfxItemPresentation /*ePres*/, MapUnit /*eCoreMetric*/, MapUnit /*ePresMetric*/, @@ -1156,16 +1089,6 @@ SfxPoolItem* SvxForbiddenRuleItem::Clone( SfxItemPool * ) const return new SvxForbiddenRuleItem( *this ); } -sal_uInt16 SvxForbiddenRuleItem::GetVersion( sal_uInt16 nFFVer ) const -{ - DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || - SOFFICE_FILEFORMAT_40==nFFVer || - SOFFICE_FILEFORMAT_50==nFFVer, - "SvxForbiddenRuleItem: Is there a new file format? "); - - return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; -} - bool SvxForbiddenRuleItem::GetPresentation( SfxItemPresentation /*ePres*/, MapUnit /*eCoreMetric*/, MapUnit /*ePresMetric*/, @@ -1192,11 +1115,6 @@ SfxPoolItem* SvxParaVertAlignItem::Clone( SfxItemPool* ) const return new SvxParaVertAlignItem( *this ); } -sal_uInt16 SvxParaVertAlignItem::GetVersion( sal_uInt16 nFFVer ) const -{ - return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; -} - bool SvxParaVertAlignItem::GetPresentation( SfxItemPresentation /*ePres*/, MapUnit /*eCoreMetric*/, MapUnit /*ePresMetric*/, @@ -1252,16 +1170,6 @@ SfxPoolItem* SvxParaGridItem::Clone( SfxItemPool * ) const return new SvxParaGridItem( *this ); } -sal_uInt16 SvxParaGridItem::GetVersion( sal_uInt16 nFFVer ) const -{ - DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || - SOFFICE_FILEFORMAT_40==nFFVer || - SOFFICE_FILEFORMAT_50==nFFVer, - "SvxParaGridItem: Is there a new file format? "); - - return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; -} - bool SvxParaGridItem::GetPresentation( SfxItemPresentation /*ePres*/, MapUnit /*eCoreMetric*/, MapUnit /*ePresMetric*/, diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index 019fb06eb621..13c5c04ffbbe 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -94,8 +94,6 @@ #include <editeng/eerdll.hxx> #include <libxml/xmlwriter.h> -#define STORE_UNICODE_MAGIC_MARKER 0xFE331188 - using namespace ::com::sun::star; using namespace ::com::sun::star::text; @@ -199,17 +197,6 @@ SvxFontItem::SvxFontItem( const FontFamily eFam, const OUString& aName, } -SvxFontItem& SvxFontItem::operator=(const SvxFontItem& rFont) -{ - aFamilyName = rFont.GetFamilyName(); - aStyleName = rFont.GetStyleName(); - eFamily = rFont.GetFamily(); - ePitch = rFont.GetPitch(); - eTextEncoding = rFont.GetCharSet(); - return *this; -} - - bool SvxFontItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { nMemberId &= ~CONVERT_TWIPS; @@ -330,64 +317,6 @@ SfxPoolItem* SvxFontItem::Clone( SfxItemPool * ) const } -SvStream& SvxFontItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const -{ - bool bToBats = IsStarSymbol( GetFamilyName() ); - - rStrm.WriteUChar( GetFamily() ).WriteUChar( GetPitch() ) - .WriteUChar( bToBats ? RTL_TEXTENCODING_SYMBOL : GetSOStoreTextEncoding(GetCharSet()) ); - - OUString aStoreFamilyName( GetFamilyName() ); - if( bToBats ) - aStoreFamilyName = "StarBats"; - rStrm.WriteUniOrByteString(aStoreFamilyName, rStrm.GetStreamCharSet()); - rStrm.WriteUniOrByteString(GetStyleName(), rStrm.GetStreamCharSet()); - - return rStrm; -} - - -SfxPoolItem* SvxFontItem::Create(SvStream& rStrm, sal_uInt16) const -{ - sal_uInt8 _eFamily, eFontPitch, eFontTextEncoding; - OUString aName, aStyle; - rStrm.ReadUChar( _eFamily ); - rStrm.ReadUChar( eFontPitch ); - rStrm.ReadUChar( eFontTextEncoding ); - - // UNICODE: rStrm >> aName; - aName = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet()); - - // UNICODE: rStrm >> aStyle; - aStyle = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet()); - - // Set the "correct" textencoding - eFontTextEncoding = static_cast<sal_uInt8>(GetSOLoadTextEncoding( eFontTextEncoding )); - - // at some point, the StarBats changes from ANSI font to SYMBOL font - if ( RTL_TEXTENCODING_SYMBOL != eFontTextEncoding && aName == "StarBats" ) - eFontTextEncoding = RTL_TEXTENCODING_SYMBOL; - - // Check if we have stored unicode - sal_uInt64 const nStreamPos = rStrm.Tell(); - sal_uInt32 nMagic = STORE_UNICODE_MAGIC_MARKER; - rStrm.ReadUInt32( nMagic ); - if ( nMagic == STORE_UNICODE_MAGIC_MARKER ) - { - aName = rStrm.ReadUniOrByteString( RTL_TEXTENCODING_UNICODE ); - aStyle = rStrm.ReadUniOrByteString( RTL_TEXTENCODING_UNICODE ); - } - else - { - rStrm.Seek( nStreamPos ); - } - - - return new SvxFontItem( static_cast<FontFamily>(_eFamily), aName, aStyle, - static_cast<FontPitch>(eFontPitch), static_cast<rtl_TextEncoding>(eFontTextEncoding), Which() ); -} - - bool SvxFontItem::GetPresentation ( SfxItemPresentation /*ePres*/, @@ -433,21 +362,6 @@ sal_uInt16 SvxPostureItem::GetValueCount() const } -SvStream& SvxPostureItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const -{ - rStrm.WriteUChar( GetValue() ); - return rStrm; -} - - -SfxPoolItem* SvxPostureItem::Create(SvStream& rStrm, sal_uInt16) const -{ - sal_uInt8 nPosture; - rStrm.ReadUChar( nPosture ); - return new SvxPostureItem( static_cast<FontItalic>(nPosture), Which() ); -} - - bool SvxPostureItem::GetPresentation ( SfxItemPresentation /*ePres*/, @@ -581,20 +495,6 @@ SfxPoolItem* SvxWeightItem::Clone( SfxItemPool * ) const } -SvStream& SvxWeightItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const -{ - rStrm.WriteUChar( GetValue() ); - return rStrm; -} - - -SfxPoolItem* SvxWeightItem::Create(SvStream& rStrm, sal_uInt16) const -{ - sal_uInt8 nWeight; - rStrm.ReadUChar( nWeight ); - return new SvxWeightItem( static_cast<FontWeight>(nWeight), Which() ); -} - bool SvxWeightItem::GetPresentation ( SfxItemPresentation /*ePres*/, @@ -697,55 +597,6 @@ SfxPoolItem* SvxFontHeightItem::Clone( SfxItemPool * ) const } -SvStream& SvxFontHeightItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const -{ - rStrm.WriteUInt16( GetHeight() ); - - if( FONTHEIGHT_UNIT_VERSION <= nItemVersion ) - rStrm.WriteUInt16( GetProp() ).WriteUInt16( static_cast<sal_uInt16>(GetPropUnit()) ); - else - { - // When exporting to the old versions the relative information is lost - // when there is no percentage - sal_uInt16 _nProp = GetProp(); - if( MapUnit::MapRelative != GetPropUnit() ) - _nProp = 100; - rStrm.WriteUInt16( _nProp ); - } - return rStrm; -} - - -SfxPoolItem* SvxFontHeightItem::Create( SvStream& rStrm, - sal_uInt16 nVersion ) const -{ - sal_uInt16 nsize, nprop = 0; - MapUnit nPropUnit = MapUnit::MapRelative; - - rStrm.ReadUInt16( nsize ); - - if( FONTHEIGHT_16_VERSION <= nVersion ) - rStrm.ReadUInt16( nprop ); - else - { - sal_uInt8 nP; - rStrm .ReadUChar( nP ); - nprop = static_cast<sal_uInt16>(nP); - } - - if( FONTHEIGHT_UNIT_VERSION <= nVersion ) - { - sal_uInt16 nTmp; - rStrm.ReadUInt16( nTmp ); - nPropUnit = static_cast<MapUnit>(nTmp); - } - - SvxFontHeightItem* pItem = new SvxFontHeightItem( nsize, 100, Which() ); - pItem->SetProp( nprop, nPropUnit ); - return pItem; -} - - bool SvxFontHeightItem::operator==( const SfxPoolItem& rItem ) const { assert(SfxPoolItem::operator==(rItem)); @@ -1009,14 +860,6 @@ bool SvxFontHeightItem::GetPresentation } -sal_uInt16 SvxFontHeightItem::GetVersion(sal_uInt16 nFileVersion) const -{ - return (nFileVersion <= SOFFICE_FILEFORMAT_40) - ? FONTHEIGHT_16_VERSION - : FONTHEIGHT_UNIT_VERSION; -} - - void SvxFontHeightItem::ScaleMetrics( long nMult, long nDiv ) { nHeight = static_cast<sal_uInt32>(Scale( nHeight, nMult, nDiv )); @@ -1112,21 +955,6 @@ sal_uInt16 SvxTextLineItem::GetValueCount() const } -SvStream& SvxTextLineItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const -{ - rStrm.WriteUChar( GetValue() ); - return rStrm; -} - - -SfxPoolItem* SvxTextLineItem::Create(SvStream& rStrm, sal_uInt16) const -{ - sal_uInt8 nState; - rStrm.ReadUChar( nState ); - return new SvxTextLineItem( static_cast<FontLineStyle>(nState), Which() ); -} - - bool SvxTextLineItem::GetPresentation ( SfxItemPresentation /*ePres*/, @@ -1232,14 +1060,6 @@ SfxPoolItem* SvxUnderlineItem::Clone( SfxItemPool * ) const } -SfxPoolItem* SvxUnderlineItem::Create(SvStream& rStrm, sal_uInt16) const -{ - sal_uInt8 nState; - rStrm.ReadUChar( nState ); - return new SvxUnderlineItem( static_cast<FontLineStyle>(nState), Which() ); -} - - OUString SvxUnderlineItem::GetValueTextByPos( sal_uInt16 nPos ) const { static const char* RID_SVXITEMS_UL[] = @@ -1283,14 +1103,6 @@ SfxPoolItem* SvxOverlineItem::Clone( SfxItemPool * ) const } -SfxPoolItem* SvxOverlineItem::Create(SvStream& rStrm, sal_uInt16) const -{ - sal_uInt8 nState; - rStrm.ReadUChar( nState ); - return new SvxOverlineItem( static_cast<FontLineStyle>(nState), Which() ); -} - - OUString SvxOverlineItem::GetValueTextByPos( sal_uInt16 nPos ) const { static const char* RID_SVXITEMS_OL[] = @@ -1358,21 +1170,6 @@ SfxPoolItem* SvxCrossedOutItem::Clone( SfxItemPool * ) const } -SvStream& SvxCrossedOutItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const -{ - rStrm.WriteUChar( GetValue() ); - return rStrm; -} - - -SfxPoolItem* SvxCrossedOutItem::Create(SvStream& rStrm, sal_uInt16) const -{ - sal_uInt8 eCross; - rStrm.ReadUChar( eCross ); - return new SvxCrossedOutItem( static_cast<FontStrikeout>(eCross), Which() ); -} - - bool SvxCrossedOutItem::GetPresentation ( SfxItemPresentation /*ePres*/, @@ -1450,21 +1247,6 @@ SfxPoolItem* SvxShadowedItem::Clone( SfxItemPool * ) const } -SvStream& SvxShadowedItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const -{ - rStrm.WriteBool( GetValue() ); - return rStrm; -} - - -SfxPoolItem* SvxShadowedItem::Create(SvStream& rStrm, sal_uInt16) const -{ - sal_uInt8 nState; - rStrm.ReadUChar( nState ); - return new SvxShadowedItem( nState, Which() ); -} - - bool SvxShadowedItem::GetPresentation ( SfxItemPresentation /*ePres*/, @@ -1556,21 +1338,6 @@ SfxPoolItem* SvxContourItem::Clone( SfxItemPool * ) const } -SvStream& SvxContourItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const -{ - rStrm.WriteBool( GetValue() ); - return rStrm; -} - - -SfxPoolItem* SvxContourItem::Create(SvStream& rStrm, sal_uInt16) const -{ - bool bValue; - rStrm.ReadCharAsBool( bValue ); - return new SvxContourItem( bValue, Which() ); -} - - bool SvxContourItem::GetPresentation ( SfxItemPresentation /*ePres*/, @@ -1665,27 +1432,10 @@ SvxColorItem::SvxColorItem( const Color& rCol, const sal_uInt16 nId ) : { } -SvxColorItem::SvxColorItem( SvStream &rStrm, const sal_uInt16 nId ) : - SfxPoolItem( nId ) -{ - Color aColor; - ReadColor( rStrm, aColor ); - mColor = aColor; -} - SvxColorItem::~SvxColorItem() { } -sal_uInt16 SvxColorItem::GetVersion( sal_uInt16 nFFVer ) const -{ - DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || - SOFFICE_FILEFORMAT_40==nFFVer || - SOFFICE_FILEFORMAT_50==nFFVer, - "SvxColorItem: Is there a new file format? "); - return SOFFICE_FILEFORMAT_50 >= nFFVer ? VERSION_USEAUTOCOLOR : 0; -} - bool SvxColorItem::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); @@ -1709,21 +1459,6 @@ SfxPoolItem* SvxColorItem::Clone( SfxItemPool * ) const return new SvxColorItem( *this ); } -SvStream& SvxColorItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const -{ - if( VERSION_USEAUTOCOLOR == nItemVersion && - COL_AUTO == mColor ) - WriteColor( rStrm, COL_BLACK ); - else - WriteColor( rStrm, mColor ); - return rStrm; -} - -SfxPoolItem* SvxColorItem::Create(SvStream& rStrm, sal_uInt16 /*nVer*/ ) const -{ - return new SvxColorItem( rStrm, Which() ); -} - bool SvxColorItem::GetPresentation ( SfxItemPresentation /*ePres*/, @@ -2328,17 +2063,6 @@ bool SvxEmphasisMarkItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) return true; } -sal_uInt16 SvxEmphasisMarkItem::GetVersion( sal_uInt16 nFFVer ) const -{ - DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || - SOFFICE_FILEFORMAT_40==nFFVer || - SOFFICE_FILEFORMAT_50==nFFVer, - "SvxEmphasisMarkItem: Is there a new file format? "); - - return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; -} - - /************************************************************************* |* class SvxTwoLinesItem *************************************************************************/ @@ -2448,17 +2172,6 @@ bool SvxTwoLinesItem::GetPresentation( SfxItemPresentation /*ePres*/, } -sal_uInt16 SvxTwoLinesItem::GetVersion( sal_uInt16 nFFVer ) const -{ - DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer || - SOFFICE_FILEFORMAT_40==nFFVer || - SOFFICE_FILEFORMAT_50==nFFVer, - "SvxTwoLinesItem: Is there a new file format?" ); - - return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; -} - - /************************************************************************* |* class SvxTextRotateItem *************************************************************************/ @@ -2473,11 +2186,6 @@ SfxPoolItem* SvxTextRotateItem::Clone(SfxItemPool*) const return new SvxTextRotateItem(*this); } -sal_uInt16 SvxTextRotateItem::GetVersion(sal_uInt16 nFFVer) const -{ - return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; -} - bool SvxTextRotateItem::GetPresentation( SfxItemPresentation /*ePres*/, MapUnit /*eCoreMetric*/, MapUnit /*ePresMetric*/, @@ -2563,11 +2271,6 @@ SfxPoolItem* SvxCharRotateItem::Clone( SfxItemPool* ) const return new SvxCharRotateItem( *this ); } -sal_uInt16 SvxCharRotateItem::GetVersion( sal_uInt16 nFFVer ) const -{ - return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; -} - bool SvxCharRotateItem::GetPresentation( SfxItemPresentation /*ePres*/, MapUnit /*eCoreMetric*/, MapUnit /*ePresMetric*/, @@ -2658,11 +2361,6 @@ SfxPoolItem* SvxCharScaleWidthItem::Clone( SfxItemPool* ) const } -sal_uInt16 SvxCharScaleWidthItem::GetVersion( sal_uInt16 nFFVer ) const -{ - return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; -} - bool SvxCharScaleWidthItem::GetPresentation( SfxItemPresentation /*ePres*/, MapUnit /*eCoreMetric*/, MapUnit /*ePresMetric*/, @@ -2717,11 +2415,6 @@ SfxPoolItem* SvxCharReliefItem::Clone( SfxItemPool * ) const return new SvxCharReliefItem( *this ); } -sal_uInt16 SvxCharReliefItem::GetVersion( sal_uInt16 nFFVer ) const -{ - return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0; -} - static const char* RID_SVXITEMS_RELIEF[] = { RID_SVXITEMS_RELIEF_NONE, @@ -2815,11 +2508,6 @@ SfxPoolItem* SvxScriptSetItem::Clone( SfxItemPool * ) const return p; } -SfxPoolItem* SvxScriptSetItem::Create( SvStream &, sal_uInt16 ) const -{ - return nullptr; -} - const SfxPoolItem* SvxScriptSetItem::GetItemOfScriptSet( const SfxItemSet& rSet, sal_uInt16 nId ) { diff --git a/editeng/source/items/writingmodeitem.cxx b/editeng/source/items/writingmodeitem.cxx index 1c6363d61667..dfa2df0de9cd 100644 --- a/editeng/source/items/writingmodeitem.cxx +++ b/editeng/source/items/writingmodeitem.cxx @@ -50,11 +50,6 @@ SfxPoolItem* SvxWritingModeItem::Clone( SfxItemPool * ) const return new SvxWritingModeItem( *this ); } -sal_uInt16 SvxWritingModeItem::GetVersion( sal_uInt16 /*nFVer*/ ) const -{ - return USHRT_MAX; -} - bool SvxWritingModeItem::GetPresentation( SfxItemPresentation /*ePres*/, MapUnit /*eCoreMetric*/, MapUnit /*ePresMetric*/, diff --git a/editeng/source/items/xmlcnitm.cxx b/editeng/source/items/xmlcnitm.cxx index ce4de850736a..4e0c25c9c239 100644 --- a/editeng/source/items/xmlcnitm.cxx +++ b/editeng/source/items/xmlcnitm.cxx @@ -68,12 +68,6 @@ bool SvXMLAttrContainerItem::GetPresentation( return false; } -sal_uInt16 SvXMLAttrContainerItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/ ) const -{ - // This item should never be stored - return USHRT_MAX; -} - bool SvXMLAttrContainerItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const { Reference<XNameContainer> xContainer diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx index 218124a009e4..41880b4f35b2 100644 --- a/editeng/source/rtf/rtfitem.cxx +++ b/editeng/source/rtf/rtfitem.cxx @@ -778,24 +778,30 @@ ATTR_SETUNDERLINE: case RTF_ULC: if( aPlainMap.nUnderline ) { - SvxUnderlineItem aUL( LINESTYLE_SINGLE, aPlainMap.nUnderline ); - const SfxPoolItem* pItem; - if( SfxItemState::SET == pSet->GetItemState( - aPlainMap.nUnderline, false, &pItem ) ) + std::unique_ptr<SvxUnderlineItem> aUL(std::make_unique<SvxUnderlineItem>(LINESTYLE_SINGLE, aPlainMap.nUnderline)); + const SfxPoolItem* pItem(nullptr); + + if( SfxItemState::SET == pSet->GetItemState(aPlainMap.nUnderline, false, &pItem ) ) { // is switched off ? - if( LINESTYLE_NONE == - static_cast<const SvxUnderlineItem*>(pItem)->GetLineStyle() ) + if( LINESTYLE_NONE == static_cast<const SvxUnderlineItem*>(pItem)->GetLineStyle() ) break; - aUL = *static_cast<const SvxUnderlineItem*>(pItem); + + aUL.reset(static_cast<SvxUnderlineItem*>(pItem->Clone())); } else - aUL = static_cast<const SvxUnderlineItem&>(pSet->Get( aPlainMap.nUnderline, false )); + { + aUL.reset(static_cast<SvxUnderlineItem*>(pSet->Get( aPlainMap.nUnderline, false).Clone())); + } - if( LINESTYLE_NONE == aUL.GetLineStyle() ) - aUL.SetLineStyle( LINESTYLE_SINGLE ); - aUL.SetColor( GetColor( sal_uInt16(nTokenValue) )); - pSet->Put( aUL ); + if(LINESTYLE_NONE == aUL->GetLineStyle()) + { + aUL->SetLineStyle(LINESTYLE_SINGLE); + } + + aUL->SetColor(GetColor(sal_uInt16(nTokenValue))); + + pSet->Put(*aUL); } break; @@ -873,24 +879,30 @@ ATTR_SETOVERLINE: case RTF_OLC: if( aPlainMap.nOverline ) { - SvxOverlineItem aOL( LINESTYLE_SINGLE, aPlainMap.nOverline ); - const SfxPoolItem* pItem; - if( SfxItemState::SET == pSet->GetItemState( - aPlainMap.nOverline, false, &pItem ) ) + std::unique_ptr<SvxOverlineItem> aOL(std::make_unique<SvxOverlineItem>(LINESTYLE_SINGLE, aPlainMap.nOverline)); + const SfxPoolItem* pItem(nullptr); + + if( SfxItemState::SET == pSet->GetItemState(aPlainMap.nOverline, false, &pItem ) ) { // is switched off ? - if( LINESTYLE_NONE == - static_cast<const SvxOverlineItem*>(pItem)->GetLineStyle() ) + if( LINESTYLE_NONE == static_cast<const SvxOverlineItem*>(pItem)->GetLineStyle() ) break; - aOL = *static_cast<const SvxOverlineItem*>(pItem); + + aOL.reset(static_cast<SvxOverlineItem*>(pItem->Clone())); } else - aOL = static_cast<const SvxOverlineItem&>(pSet->Get( aPlainMap.nOverline, false )); + { + aOL.reset(static_cast<SvxOverlineItem*>(pSet->Get( aPlainMap.nOverline, false).Clone())); + } + + if(LINESTYLE_NONE == aOL->GetLineStyle()) + { + aOL->SetLineStyle(LINESTYLE_SINGLE); + } - if( LINESTYLE_NONE == aOL.GetLineStyle() ) - aOL.SetLineStyle( LINESTYLE_SINGLE ); - aOL.SetColor( GetColor( sal_uInt16(nTokenValue) )); - pSet->Put( aOL ); + aOL->SetColor(GetColor(sal_uInt16(nTokenValue))); + + pSet->Put(*aOL); } break; @@ -1372,10 +1384,13 @@ void SvxRTFParser::ReadBorderAttr( int nToken, SfxItemSet& rSet, bool bTableDef ) { // then read the border attribute - SvxBoxItem aAttr( aPardMap.nBox ); - const SfxPoolItem* pItem; + std::unique_ptr<SvxBoxItem> aAttr(std::make_unique<SvxBoxItem>(aPardMap.nBox)); + const SfxPoolItem* pItem(nullptr); + if( SfxItemState::SET == rSet.GetItemState( aPardMap.nBox, false, &pItem ) ) - aAttr = *static_cast<const SvxBoxItem*>(pItem); + { + aAttr.reset(static_cast<SvxBoxItem*>(pItem->Clone())); + } SvxBorderLine aBrd( nullptr, DEF_LINE_WIDTH_0 ); // Simple plain line bool bContinue = true; @@ -1400,7 +1415,7 @@ void SvxRTFParser::ReadBorderAttr( int nToken, SfxItemSet& rSet, if( bTableDef ) { if (nBorderTyp != 0) - SetBorderLine( nBorderTyp, aAttr, aBrd ); + SetBorderLine( nBorderTyp, *aAttr, aBrd ); nBorderTyp = RTF_BRDRT; } break; @@ -1410,7 +1425,7 @@ void SvxRTFParser::ReadBorderAttr( int nToken, SfxItemSet& rSet, if( bTableDef ) { if (nBorderTyp != 0) - SetBorderLine( nBorderTyp, aAttr, aBrd ); + SetBorderLine( nBorderTyp, *aAttr, aBrd ); nBorderTyp = RTF_BRDRB; } break; @@ -1420,7 +1435,7 @@ void SvxRTFParser::ReadBorderAttr( int nToken, SfxItemSet& rSet, if( bTableDef ) { if (nBorderTyp != 0) - SetBorderLine( nBorderTyp, aAttr, aBrd ); + SetBorderLine( nBorderTyp, *aAttr, aBrd ); nBorderTyp = RTF_BRDRL; } break; @@ -1430,7 +1445,7 @@ void SvxRTFParser::ReadBorderAttr( int nToken, SfxItemSet& rSet, if( bTableDef ) { if (nBorderTyp != 0) - SetBorderLine( nBorderTyp, aAttr, aBrd ); + SetBorderLine( nBorderTyp, *aAttr, aBrd ); nBorderTyp = RTF_BRDRR; } break; @@ -1506,23 +1521,23 @@ void SvxRTFParser::ReadBorderAttr( int nToken, SfxItemSet& rSet, switch( nBorderTyp ) { case RTF_BRDRB: - aAttr.SetDistance( static_cast<sal_uInt16>(nTokenValue), SvxBoxItemLine::BOTTOM ); + aAttr->SetDistance( static_cast<sal_uInt16>(nTokenValue), SvxBoxItemLine::BOTTOM ); break; case RTF_BRDRT: - aAttr.SetDistance( static_cast<sal_uInt16>(nTokenValue), SvxBoxItemLine::TOP ); + aAttr->SetDistance( static_cast<sal_uInt16>(nTokenValue), SvxBoxItemLine::TOP ); break; case RTF_BRDRL: - aAttr.SetDistance( static_cast<sal_uInt16>(nTokenValue), SvxBoxItemLine::LEFT ); + aAttr->SetDistance( static_cast<sal_uInt16>(nTokenValue), SvxBoxItemLine::LEFT ); break; case RTF_BRDRR: - aAttr.SetDistance( static_cast<sal_uInt16>(nTokenValue), SvxBoxItemLine::RIGHT ); + aAttr->SetDistance( static_cast<sal_uInt16>(nTokenValue), SvxBoxItemLine::RIGHT ); break; case RTF_BOX: - aAttr.SetAllDistances( static_cast<sal_uInt16>(nTokenValue) ); + aAttr->SetAllDistances( static_cast<sal_uInt16>(nTokenValue) ); break; } } @@ -1544,9 +1559,9 @@ void SvxRTFParser::ReadBorderAttr( int nToken, SfxItemSet& rSet, if ( bDoubleWidth ) nWidth *= 2; aBrd.SetWidth( nWidth ); - SetBorderLine( nBorderTyp, aAttr, aBrd ); + SetBorderLine( nBorderTyp, *aAttr, aBrd ); - rSet.Put( aAttr ); + rSet.Put( *aAttr ); SkipToken(); } diff --git a/include/editeng/adjustitem.hxx b/include/editeng/adjustitem.hxx index 2918bb915d7b..a06b177dd719 100644 --- a/include/editeng/adjustitem.hxx +++ b/include/editeng/adjustitem.hxx @@ -65,9 +65,6 @@ public: virtual sal_uInt16 GetEnumValue() const override; virtual void SetEnumValue( sal_uInt16 nNewVal ) override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const override; - virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const override; void SetOneWord( const SvxAdjust eType ) { @@ -120,6 +117,25 @@ public: eRet = SvxAdjust::Block; return eRet; } + + sal_Int8 GetAsFlags() const + { + sal_Int8 nFlags = 0; + if ( bOneBlock ) + nFlags |= 0x0001; + if ( bLastCenter ) + nFlags |= 0x0002; + if ( bLastBlock ) + nFlags |= 0x0004; + return nFlags; + } + + void SetAsFlags(sal_Int8 nFlags) + { + bOneBlock = 0 != (nFlags & 0x0001); + bLastCenter = 0 != (nFlags & 0x0002); + bLastBlock = 0 != (nFlags & 0x0004); + } }; #endif diff --git a/include/editeng/boxitem.hxx b/include/editeng/boxitem.hxx index db97f78e6d0f..38b19173f183 100644 --- a/include/editeng/boxitem.hxx +++ b/include/editeng/boxitem.hxx @@ -71,7 +71,6 @@ public: explicit SvxBoxItem( const sal_uInt16 nId ); SvxBoxItem( const SvxBoxItem &rCpy ); virtual ~SvxBoxItem() override; - SvxBoxItem &operator=( const SvxBoxItem& rBox ); // "pure virtual Methods" from SfxPoolItem virtual bool operator==( const SfxPoolItem& ) const override; @@ -84,9 +83,6 @@ public: OUString &rText, const IntlWrapper& ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const override; - virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const override; virtual void ScaleMetrics( long nMult, long nDiv ) override; virtual bool HasMetrics() const override; @@ -189,7 +185,6 @@ public: explicit SvxBoxInfoItem( const sal_uInt16 nId ); SvxBoxInfoItem( const SvxBoxInfoItem &rCpy ); virtual ~SvxBoxInfoItem() override; - SvxBoxInfoItem &operator=( const SvxBoxInfoItem &rCpy ); // "pure virtual Methods" from SfxPoolItem virtual bool operator==( const SfxPoolItem& ) const override; diff --git a/include/editeng/brushitem.hxx b/include/editeng/brushitem.hxx index 952b037c937b..8f298bd43408 100644 --- a/include/editeng/brushitem.hxx +++ b/include/editeng/brushitem.hxx @@ -55,9 +55,6 @@ class EDITENG_DLLPUBLIC SvxBrushItem : public SfxPoolItem mutable bool bLoadAgain; void ApplyGraphicTransparency_Impl(); - // only used by Create - SvxBrushItem( SvStream& rStrm, - sal_uInt16 nVersion, sal_uInt16 nWhich ); public: static SfxPoolItem* CreateDefault(); @@ -90,9 +87,6 @@ public: virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nVersion ) const override; - virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const override; const Color& GetColor() const { return aColor; } Color& GetColor() { return aColor; } @@ -116,9 +110,6 @@ public: void SetGraphicLink( const OUString& rNew ); void SetGraphicFilter( const OUString& rNew ); - SvxBrushItem& operator=(const SvxBrushItem& rItem); - SvxBrushItem& operator=(SvxBrushItem&& rItem); - static sal_Int8 TransparencyToPercent(sal_Int32 nTrans); void dumpAsXml(xmlTextWriterPtr pWriter) const override; diff --git a/include/editeng/bulletitem.hxx b/include/editeng/bulletitem.hxx index 012138c3b7ca..be792db86804 100644 --- a/include/editeng/bulletitem.hxx +++ b/include/editeng/bulletitem.hxx @@ -79,7 +79,6 @@ public: void SetFont( const vcl::Font& rNew) { aFont = rNew; } void SetScale( sal_uInt16 nNew ) { nScale = nNew; } - virtual sal_uInt16 GetVersion(sal_uInt16 nFileVersion) const override; virtual bool operator==( const SfxPoolItem& ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, MapUnit eCoreMetric, diff --git a/include/editeng/charreliefitem.hxx b/include/editeng/charreliefitem.hxx index 80f269feea1f..64809845dfce 100644 --- a/include/editeng/charreliefitem.hxx +++ b/include/editeng/charreliefitem.hxx @@ -40,7 +40,6 @@ public: const sal_uInt16 nId ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const override; static OUString GetValueTextByPos( sal_uInt16 nPos ); virtual sal_uInt16 GetValueCount() const override; diff --git a/include/editeng/charrotateitem.hxx b/include/editeng/charrotateitem.hxx index 794ef447c2e9..efa62398cec3 100644 --- a/include/editeng/charrotateitem.hxx +++ b/include/editeng/charrotateitem.hxx @@ -37,7 +37,6 @@ public: SvxTextRotateItem(sal_uInt16 nValue, const sal_uInt16 nId); virtual SfxPoolItem* Clone(SfxItemPool *pPool = nullptr) const override; - virtual sal_uInt16 GetVersion(sal_uInt16 nFileVersion) const override; virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, @@ -83,7 +82,6 @@ public: const sal_uInt16 nId ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, MapUnit eCoreMetric, diff --git a/include/editeng/charscaleitem.hxx b/include/editeng/charscaleitem.hxx index cd116334d005..d8397f4e19ff 100644 --- a/include/editeng/charscaleitem.hxx +++ b/include/editeng/charscaleitem.hxx @@ -41,7 +41,6 @@ public: const sal_uInt16 nId ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, MapUnit eCoreMetric, diff --git a/include/editeng/colritem.hxx b/include/editeng/colritem.hxx index 5e62965486ba..d371b9ace3af 100644 --- a/include/editeng/colritem.hxx +++ b/include/editeng/colritem.hxx @@ -37,28 +37,18 @@ public: explicit SvxColorItem(const sal_uInt16 nId); SvxColorItem(const Color& aColor, const sal_uInt16 nId); - SvxColorItem(SvStream& rStream, const sal_uInt16 nId); virtual ~SvxColorItem() override; // "pure virtual Methods" from SfxPoolItem virtual bool operator==(const SfxPoolItem& rPoolItem) const override; virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override; - virtual sal_uInt16 GetVersion(sal_uInt16 nFileVersion) const override; virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper& rIntlWrapper) const override; virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override; - virtual SfxPoolItem* Create(SvStream& rStream, sal_uInt16 nVersion) const override; - virtual SvStream& Store(SvStream& rStream, sal_uInt16 nVersion) const override; - - SvxColorItem& operator=(const SvxColorItem& rColor) - { - SetValue(rColor.GetValue()); - return *this; - } SvxColorItem(SvxColorItem const &) = default; // SfxPoolItem copy function dichotomy const Color& GetValue() const diff --git a/include/editeng/contouritem.hxx b/include/editeng/contouritem.hxx index d0514da0d174..0941e21d856c 100644 --- a/include/editeng/contouritem.hxx +++ b/include/editeng/contouritem.hxx @@ -38,20 +38,11 @@ public: // "pure virtual Methods" from SfxPoolItem virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const override; - virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const override; virtual bool GetPresentation( SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper& ) const override; - - SvxContourItem& operator=(const SvxContourItem& rCont) - { - SetValue(rCont.GetValue()); - return *this; - } - SvxContourItem(SvxContourItem const &) = default; // SfxPoolItem copy function dichotomy }; #endif diff --git a/include/editeng/crossedoutitem.hxx b/include/editeng/crossedoutitem.hxx index e8edcbc23258..f7967588ffd5 100644 --- a/include/editeng/crossedoutitem.hxx +++ b/include/editeng/crossedoutitem.hxx @@ -44,8 +44,6 @@ public: OUString &rText, const IntlWrapper& ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const override; - virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const override; static OUString GetValueTextByPos( sal_uInt16 nPos ); virtual sal_uInt16 GetValueCount() const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; @@ -57,11 +55,6 @@ public: virtual bool GetBoolValue() const override; virtual void SetBoolValue( bool bVal ) override; - SvxCrossedOutItem& operator=(const SvxCrossedOutItem& rCross) - { - SetValue( rCross.GetValue() ); - return *this; - } SvxCrossedOutItem(SvxCrossedOutItem const &) = default; // SfxPoolItem copy function dichotomy // enum cast diff --git a/include/editeng/emphasismarkitem.hxx b/include/editeng/emphasismarkitem.hxx index d9c33ab4e4a6..86a3ab0837f3 100644 --- a/include/editeng/emphasismarkitem.hxx +++ b/include/editeng/emphasismarkitem.hxx @@ -46,7 +46,6 @@ public: const IntlWrapper& ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; diff --git a/include/editeng/fhgtitem.hxx b/include/editeng/fhgtitem.hxx index 686eed994ff0..5e67a71f0676 100644 --- a/include/editeng/fhgtitem.hxx +++ b/include/editeng/fhgtitem.hxx @@ -41,6 +41,11 @@ class EDITENG_DLLPUBLIC SvxFontHeightItem : public SfxPoolItem sal_uInt32 nHeight; sal_uInt16 nProp; // default 100% MapUnit ePropUnit; // Percent, Twip, ... + +private: + friend void Create_legacy_direct_set(SvxFontHeightItem& rItem, sal_uInt32 nH, sal_uInt16 nP, MapUnit eP); + void legacy_direct_set(sal_uInt32 nH, sal_uInt16 nP, MapUnit eP) { nHeight = nH; nProp = nP; ePropUnit = eP; } + public: static SfxPoolItem* CreateDefault(); @@ -58,22 +63,9 @@ public: OUString &rText, const IntlWrapper& ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const override; - virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nItemVersion) const override; virtual void ScaleMetrics( long nMult, long nDiv ) override; virtual bool HasMetrics() const override; - SvxFontHeightItem& operator=(const SvxFontHeightItem& rSize) - { - DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" ); - nHeight = rSize.nHeight; - nProp = rSize.nProp; - ePropUnit = rSize.ePropUnit; - return *this; - } - SvxFontHeightItem(SvxFontHeightItem const &) = default; // SfxPoolItem copy function dichotomy - void SetHeight( sal_uInt32 nNewHeight, const sal_uInt16 nNewProp = 100, MapUnit eUnit = MapUnit::MapRelative ); diff --git a/include/editeng/fontitem.hxx b/include/editeng/fontitem.hxx index f3ede8d73547..66134a2ea9d3 100644 --- a/include/editeng/fontitem.hxx +++ b/include/editeng/fontitem.hxx @@ -47,8 +47,6 @@ public: // "pure virtual Methods" from SfxPoolItem virtual bool operator==(const SfxPoolItem& rItem) const override; virtual SfxPoolItem* Clone(SfxItemPool *pPool = nullptr) const override; - virtual SfxPoolItem* Create(SvStream& rStream, sal_uInt16) const override; - virtual SvStream& Store(SvStream& rStream, sal_uInt16 nItemVersion) const override; virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override; @@ -102,9 +100,6 @@ public: return eTextEncoding; } - SvxFontItem& operator=(const SvxFontItem& rFont); - SvxFontItem(SvxFontItem const &) = default; // SfxPoolItem copy function dichotomy - void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; diff --git a/include/editeng/forbiddenruleitem.hxx b/include/editeng/forbiddenruleitem.hxx index 6213eab66a64..66111f91f55f 100644 --- a/include/editeng/forbiddenruleitem.hxx +++ b/include/editeng/forbiddenruleitem.hxx @@ -36,7 +36,6 @@ public: const sal_uInt16 nId ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, MapUnit eCoreMetric, diff --git a/include/editeng/formatbreakitem.hxx b/include/editeng/formatbreakitem.hxx index 6eb2e03b5264..760aca9c4a3b 100644 --- a/include/editeng/formatbreakitem.hxx +++ b/include/editeng/formatbreakitem.hxx @@ -40,7 +40,6 @@ public: inline SvxFormatBreakItem( const SvxBreak eBrk /*= SvxBreak::NONE*/, const sal_uInt16 nWhich ); - inline SvxFormatBreakItem& operator=( const SvxFormatBreakItem& rCpy ); SvxFormatBreakItem(SvxFormatBreakItem const &) = default; // SfxPoolItem copy function dichotomy // "pure virtual Methods" from SfxPoolItem @@ -55,9 +54,6 @@ public: static OUString GetValueTextByPos( sal_uInt16 nPos ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const override; - virtual SfxPoolItem* Create( SvStream&, sal_uInt16 ) const override; virtual sal_uInt16 GetValueCount() const override; SvxBreak GetBreak() const { return GetValue(); } @@ -70,13 +66,6 @@ inline SvxFormatBreakItem::SvxFormatBreakItem( const SvxBreak eBreak, {} -inline SvxFormatBreakItem& SvxFormatBreakItem::operator=( - const SvxFormatBreakItem& rBreak ) -{ - SetValue( rBreak.GetBreak() ); - return *this; -} - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/frmdiritem.hxx b/include/editeng/frmdiritem.hxx index 25467ee628b8..840cae4a2f9e 100644 --- a/include/editeng/frmdiritem.hxx +++ b/include/editeng/frmdiritem.hxx @@ -35,8 +35,6 @@ public: virtual ~SvxFrameDirectionItem() override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, MapUnit eCoreMetric, @@ -51,12 +49,7 @@ public: { return sal_uInt16(SvxFrameDirection::Environment) + 1; } - SvxFrameDirectionItem& operator=( const SvxFrameDirectionItem& rItem ) - { - SetValue( rItem.GetValue() ); - return *this; - } - SvxFrameDirectionItem(SvxFrameDirectionItem const &) = default; + // SfxPoolItem copy function dichotomy void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; diff --git a/include/editeng/hngpnctitem.hxx b/include/editeng/hngpnctitem.hxx index dea50716f29d..791890d023ca 100644 --- a/include/editeng/hngpnctitem.hxx +++ b/include/editeng/hngpnctitem.hxx @@ -35,7 +35,6 @@ public: SvxHangingPunctuationItem( bool bOn /*= false*/, const sal_uInt16 nId ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, MapUnit eCoreMetric, diff --git a/include/editeng/justifyitem.hxx b/include/editeng/justifyitem.hxx index 7c25846e63d3..c53a7b83b744 100644 --- a/include/editeng/justifyitem.hxx +++ b/include/editeng/justifyitem.hxx @@ -47,13 +47,7 @@ public: virtual sal_uInt16 GetValueCount() const override; static OUString GetValueText( sal_uInt16 nVal ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const override; - SvxHorJustifyItem& operator=(const SvxHorJustifyItem& rHorJustify) - { - SetValue( rHorJustify.GetValue() ); - return *this; - } SvxHorJustifyItem(SvxHorJustifyItem const &) = default; // SfxPoolItem copy function dichotomy }; @@ -80,13 +74,7 @@ public: virtual sal_uInt16 GetValueCount() const override; static OUString GetValueText( SvxCellVerJustify nVal ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const override; - SvxVerJustifyItem& operator=(const SvxVerJustifyItem& rVerJustify) - { - SetValue( rVerJustify.GetValue() ); - return *this; - } SvxVerJustifyItem(SvxVerJustifyItem const &) = default; // SfxPoolItem copy function dichotomy }; diff --git a/include/editeng/keepitem.hxx b/include/editeng/keepitem.hxx index b5f0ddbd6418..f30d91289a44 100644 --- a/include/editeng/keepitem.hxx +++ b/include/editeng/keepitem.hxx @@ -37,13 +37,10 @@ public: inline SvxFormatKeepItem( const bool bKeep /*= false*/, const sal_uInt16 _nWhich ); - inline SvxFormatKeepItem& operator=( const SvxFormatKeepItem& rSplit ); SvxFormatKeepItem(SvxFormatKeepItem const &) = default; // SfxPoolItem copy function dichotomy // "pure virtual Methods" from SfxPoolItem virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SfxPoolItem* Create( SvStream&, sal_uInt16 ) const override; - virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, MapUnit eCoreMetric, @@ -55,12 +52,6 @@ inline SvxFormatKeepItem::SvxFormatKeepItem( const bool bKeep, const sal_uInt16 SfxBoolItem( _nWhich, bKeep ) {} -inline SvxFormatKeepItem& SvxFormatKeepItem::operator=( const SvxFormatKeepItem& rKeep ) -{ - SetValue( rKeep.GetValue() ); - return *this; -} - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/langitem.hxx b/include/editeng/langitem.hxx index 78e19d745f18..4894edd79465 100644 --- a/include/editeng/langitem.hxx +++ b/include/editeng/langitem.hxx @@ -55,11 +55,6 @@ public: virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; virtual sal_uInt16 GetValueCount() const override; - SvxLanguageItem& operator=(const SvxLanguageItem& rLang) - { - SetValue( rLang.GetValue() ); - return *this; - } SvxLanguageItem(SvxLanguageItem const &) = default; // SfxPoolItem copy function dichotomy LanguageType GetLanguage() const diff --git a/include/editeng/legacyitem.hxx b/include/editeng/legacyitem.hxx new file mode 100755 index 000000000000..4f118eff92c2 --- /dev/null +++ b/include/editeng/legacyitem.hxx @@ -0,0 +1,192 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_EDITENG_LEGACYITEM_HXX +#define INCLUDED_EDITENG_LEGACYITEM_HXX + +#include <editeng/editengdllapi.h> + +////////////////////////////////////////////////////////////////////////////// +// // editeng +// SvxFontItem aFont; +// SvxFontHeightItem aHeight; +// SvxWeightItem aWeight; +// SvxPostureItem aPosture; +// SvxUnderlineItem aUnderline; +// SvxOverlineItem aOverline; +// SvxCrossedOutItem aCrossedOut; +// SvxContourItem aContour; +// SvxShadowedItem aShadowed; +// SvxColorItem aColor; +// SvxBoxItem aBox; +// SvxLineItem aTLBR; +// SvxBrushItem aBackground; +// SvxAdjustItem aAdjust; +// SvxHorJustifyItem aHorJustify; +// SvxVerJustifyItem aVerJustify; +// SvxFrameDirectionItem m_aTextOrientation; +////////////////////////////////////////////////////////////////////////////// + +class SvStream; +class SvxFontItem; +class SvxFontHeightItem; +class SvxWeightItem; +class SvxPostureItem; +class SvxTextLineItem; +class SvxCrossedOutItem; +class SvxShadowedItem; +class SvxColorItem; +class SvxBoxItem; +class SvxLineItem; +class SvxBrushItem; +class SvxAdjustItem; +class SvxHorJustifyItem; +class SvxVerJustifyItem; +class SvxFrameDirectionItem; +class SvxFormatBreakItem; +class SvxFormatKeepItem; +class SvxShadowItem; + +namespace legacy +{ + namespace SvxFont + { + sal_uInt16 EDITENG_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion); + void EDITENG_DLLPUBLIC Create(SvxFontItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + EDITENG_DLLPUBLIC SvStream& Store(const SvxFontItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxFontHeight + { + sal_uInt16 EDITENG_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion); + void EDITENG_DLLPUBLIC Create(SvxFontHeightItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + EDITENG_DLLPUBLIC SvStream& Store(const SvxFontHeightItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxWeight + { + sal_uInt16 EDITENG_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion); + void EDITENG_DLLPUBLIC Create(SvxWeightItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + EDITENG_DLLPUBLIC SvStream& Store(const SvxWeightItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxPosture + { + sal_uInt16 EDITENG_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion); + void EDITENG_DLLPUBLIC Create(SvxPostureItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + EDITENG_DLLPUBLIC SvStream& Store(const SvxPostureItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxTextLine // SvxUnderlineItem, SvxOverlineItem -> SvxTextLineItem + { + sal_uInt16 EDITENG_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion); + void EDITENG_DLLPUBLIC Create(SvxTextLineItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + EDITENG_DLLPUBLIC SvStream& Store(const SvxTextLineItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxCrossedOut + { + sal_uInt16 EDITENG_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion); + void EDITENG_DLLPUBLIC Create(SvxCrossedOutItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + EDITENG_DLLPUBLIC SvStream& Store(const SvxCrossedOutItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + // SvxContourItem -> SfxBoolItem + // SvxShadowedItem -> SfxBoolItem + + namespace SvxColor + { + sal_uInt16 EDITENG_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion); + void EDITENG_DLLPUBLIC Create(SvxColorItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + EDITENG_DLLPUBLIC SvStream& Store(const SvxColorItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxBox + { + sal_uInt16 EDITENG_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion); + void EDITENG_DLLPUBLIC Create(SvxBoxItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + EDITENG_DLLPUBLIC SvStream& Store(const SvxBoxItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxLine + { + sal_uInt16 EDITENG_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion); + void EDITENG_DLLPUBLIC Create(SvxLineItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + EDITENG_DLLPUBLIC SvStream& Store(const SvxLineItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxBrush + { + sal_uInt16 EDITENG_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion); + void EDITENG_DLLPUBLIC Create(SvxBrushItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + EDITENG_DLLPUBLIC SvStream& Store(const SvxBrushItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxAdjust + { + sal_uInt16 EDITENG_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion); + void EDITENG_DLLPUBLIC Create(SvxAdjustItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + EDITENG_DLLPUBLIC SvStream& Store(const SvxAdjustItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxHorJustify + { + sal_uInt16 EDITENG_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion); + void EDITENG_DLLPUBLIC Create(SvxHorJustifyItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + EDITENG_DLLPUBLIC SvStream& Store(const SvxHorJustifyItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxVerJustify + { + sal_uInt16 EDITENG_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion); + void EDITENG_DLLPUBLIC Create(SvxVerJustifyItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + EDITENG_DLLPUBLIC SvStream& Store(const SvxVerJustifyItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxFrameDirection + { + sal_uInt16 EDITENG_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion); + void EDITENG_DLLPUBLIC Create(SvxFrameDirectionItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + EDITENG_DLLPUBLIC SvStream& Store(const SvxFrameDirectionItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxFormatBreak + { + sal_uInt16 EDITENG_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion); + void EDITENG_DLLPUBLIC Create(SvxFormatBreakItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + EDITENG_DLLPUBLIC SvStream& Store(const SvxFormatBreakItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxFormatKeep + { + sal_uInt16 EDITENG_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion); + void EDITENG_DLLPUBLIC Create(SvxFormatKeepItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + EDITENG_DLLPUBLIC SvStream& Store(const SvxFormatKeepItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + + namespace SvxShadow + { + sal_uInt16 EDITENG_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion); + void EDITENG_DLLPUBLIC Create(SvxShadowItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + EDITENG_DLLPUBLIC SvStream& Store(const SvxShadowItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } +} + +#endif // INCLUDED_EDITENG_LEGACYITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/lineitem.hxx b/include/editeng/lineitem.hxx index 2dcdc97a763b..8d74b66ce462 100644 --- a/include/editeng/lineitem.hxx +++ b/include/editeng/lineitem.hxx @@ -44,7 +44,6 @@ public: explicit SvxLineItem( const sal_uInt16 nId ); SvxLineItem( const SvxLineItem& rCpy ); virtual ~SvxLineItem() override; - SvxLineItem &operator=( const SvxLineItem& rLine ); virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; @@ -55,8 +54,6 @@ public: OUString &rText, const IntlWrapper& ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const override; - virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const override; virtual void ScaleMetrics( long nMult, long nDiv ) override; virtual bool HasMetrics() const override; diff --git a/include/editeng/lrspitem.hxx b/include/editeng/lrspitem.hxx index 6cc7ad48a3b7..ba3fe2fbb867 100644 --- a/include/editeng/lrspitem.hxx +++ b/include/editeng/lrspitem.hxx @@ -68,7 +68,6 @@ public: SvxLRSpaceItem( const long nLeft, const long nRight, const long nTLeft /*= 0*/, const short nOfset /*= 0*/, const sal_uInt16 nId ); - inline SvxLRSpaceItem& operator=( const SvxLRSpaceItem &rCpy ); SvxLRSpaceItem(SvxLRSpaceItem const &) = default; // SfxPoolItem copy function dichotomy // "pure virtual Methods" from SfxPoolItem @@ -83,7 +82,6 @@ public: OUString &rText, const IntlWrapper& ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const override; virtual void ScaleMetrics( long nMult, long nDiv ) override; virtual bool HasMetrics() const override; @@ -121,21 +119,6 @@ public: void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; -inline SvxLRSpaceItem &SvxLRSpaceItem::operator=( const SvxLRSpaceItem &rCpy ) -{ - nFirstLineOfst = rCpy.nFirstLineOfst; - nTxtLeft = rCpy.nTxtLeft; - nLeftMargin = rCpy.nLeftMargin; - nRightMargin = rCpy.nRightMargin; - nPropFirstLineOfst = rCpy.nPropFirstLineOfst; - nPropLeftMargin = rCpy.nPropLeftMargin; - nPropRightMargin = rCpy.nPropRightMargin; - bAutoFirst = rCpy.bAutoFirst; - bExplicitZeroMarginValRight = rCpy.bExplicitZeroMarginValRight; - bExplicitZeroMarginValLeft = rCpy.bExplicitZeroMarginValLeft; - return *this; -} - inline void SvxLRSpaceItem::SetLeft( const long nL, const sal_uInt16 nProp ) { nLeftMargin = (nL * nProp) / 100; diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx index e758d9021cf5..7757948a54aa 100644 --- a/include/editeng/numitem.hxx +++ b/include/editeng/numitem.hxx @@ -301,7 +301,6 @@ public: virtual ~SvxNumBulletItem() override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const override; virtual bool operator==( const SfxPoolItem& ) const override; SvxNumRule* GetNumRule() const {return pNumRule.get();} diff --git a/include/editeng/opaqitem.hxx b/include/editeng/opaqitem.hxx index 17517e6c59e7..268901ad956a 100644 --- a/include/editeng/opaqitem.hxx +++ b/include/editeng/opaqitem.hxx @@ -34,8 +34,6 @@ class EDITENG_DLLPUBLIC SvxOpaqueItem : public SfxBoolItem { public: explicit SvxOpaqueItem( const sal_uInt16 nId , const bool bOpa = true ); - inline SvxOpaqueItem &operator=( const SvxOpaqueItem &rCpy ); - SvxOpaqueItem(SvxOpaqueItem const &) = default; // SfxPoolItem copy function dichotomy // "pure virtual Methods" from SfxPoolItem virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; @@ -50,13 +48,6 @@ inline SvxOpaqueItem::SvxOpaqueItem( const sal_uInt16 nId, const bool bOpa ) : SfxBoolItem( nId, bOpa ) {} -inline SvxOpaqueItem &SvxOpaqueItem::operator=( const SvxOpaqueItem &rCpy ) -{ - SetValue( rCpy.GetValue() ); - return *this; -} - - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/paravertalignitem.hxx b/include/editeng/paravertalignitem.hxx index 57f82c6d8e44..4aa3865739e9 100644 --- a/include/editeng/paravertalignitem.hxx +++ b/include/editeng/paravertalignitem.hxx @@ -41,7 +41,6 @@ public: const sal_uInt16 nId ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, MapUnit eCoreMetric, diff --git a/include/editeng/pgrditem.hxx b/include/editeng/pgrditem.hxx index 7a830036fdcc..a38ab1bbe807 100644 --- a/include/editeng/pgrditem.hxx +++ b/include/editeng/pgrditem.hxx @@ -38,7 +38,6 @@ public: // "pure virtual Methods" from SfxPoolItem virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, MapUnit eCoreMetric, diff --git a/include/editeng/postitem.hxx b/include/editeng/postitem.hxx index 9383689cc510..91e781dd199c 100644 --- a/include/editeng/postitem.hxx +++ b/include/editeng/postitem.hxx @@ -45,8 +45,6 @@ public: OUString &rText, const IntlWrapper& ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const override; - virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const override; static OUString GetValueTextByPos( sal_uInt16 nPos ); virtual sal_uInt16 GetValueCount() const override; @@ -57,12 +55,6 @@ public: virtual bool GetBoolValue() const override; virtual void SetBoolValue( bool bVal ) override; - SvxPostureItem& operator=(const SvxPostureItem& rPost) { - SetValue( rPost.GetValue() ); - return *this; - } - SvxPostureItem(SvxPostureItem const &) = default; // SfxPoolItem copy function dichotomy - // enum cast FontItalic GetPosture() const { return GetValue(); } diff --git a/include/editeng/protitem.hxx b/include/editeng/protitem.hxx index 178594ff2926..e7c7da1cf50b 100644 --- a/include/editeng/protitem.hxx +++ b/include/editeng/protitem.hxx @@ -40,7 +40,6 @@ public: static SfxPoolItem* CreateDefault(); explicit inline SvxProtectItem( const sal_uInt16 nId ); - inline SvxProtectItem &operator=( const SvxProtectItem &rCpy ); SvxProtectItem(SvxProtectItem const &) = default; // SfxPoolItem copy function dichotomy // "pure virtual Methods" from SfxPoolItem @@ -72,15 +71,6 @@ inline SvxProtectItem::SvxProtectItem( const sal_uInt16 nId ) bCntnt = bSize = bPos = false; } -inline SvxProtectItem &SvxProtectItem::operator=( const SvxProtectItem &rCpy ) -{ - bCntnt = rCpy.IsContentProtected(); - bSize = rCpy.IsSizeProtected(); - bPos = rCpy.IsPosProtected(); - return *this; -} - - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/scriptspaceitem.hxx b/include/editeng/scriptspaceitem.hxx index 46d3be6c7315..c1b5f80ead83 100644 --- a/include/editeng/scriptspaceitem.hxx +++ b/include/editeng/scriptspaceitem.hxx @@ -37,7 +37,6 @@ public: const sal_uInt16 nId ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, MapUnit eCoreMetric, diff --git a/include/editeng/scripttypeitem.hxx b/include/editeng/scripttypeitem.hxx index 49c3945ca7d7..efe6b7a4d192 100644 --- a/include/editeng/scripttypeitem.hxx +++ b/include/editeng/scripttypeitem.hxx @@ -29,7 +29,6 @@ public: SvxScriptSetItem( sal_uInt16 nSlotId, SfxItemPool& rPool ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SfxPoolItem* Create( SvStream &, sal_uInt16 nVersion ) const override; static const SfxPoolItem* GetItemOfScriptSet( const SfxItemSet& rSet, sal_uInt16 nWhich ); diff --git a/include/editeng/shaditem.hxx b/include/editeng/shaditem.hxx index cae821ba4b86..187bb39aa04a 100644 --- a/include/editeng/shaditem.hxx +++ b/include/editeng/shaditem.hxx @@ -47,9 +47,6 @@ public: const Color *pColor = nullptr, const sal_uInt16 nWidth = 100 /*5pt*/, const SvxShadowLocation eLoc = SvxShadowLocation::NONE ); - inline SvxShadowItem& operator=( const SvxShadowItem& rFmtShadow ); - SvxShadowItem(SvxShadowItem const &) = default; // SfxPoolItem copy function dichotomy - // "pure virtual Methods" from SfxPoolItem virtual bool operator==( const SfxPoolItem& ) const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; @@ -61,8 +58,6 @@ public: OUString &rText, const IntlWrapper& ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const override; - virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const override; virtual void ScaleMetrics( long nMult, long nDiv ) override; virtual bool HasMetrics() const override; @@ -84,14 +79,6 @@ public: void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; -inline SvxShadowItem &SvxShadowItem::operator=( const SvxShadowItem& rFmtShadow ) -{ - aShadowColor = rFmtShadow.aShadowColor; - nWidth = rFmtShadow.GetWidth(); - eLocation = rFmtShadow.GetLocation(); - return *this; -} - #endif // INCLUDED_EDITENG_SHADITEM_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/shdditem.hxx b/include/editeng/shdditem.hxx index 15bb414e06ce..a201549bfab4 100644 --- a/include/editeng/shdditem.hxx +++ b/include/editeng/shdditem.hxx @@ -39,18 +39,12 @@ public: // "pure virtual Methods" from SfxPoolItem virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const override; - virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const override; virtual bool GetPresentation( SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper& ) const override; - SvxShadowedItem& operator=(const SvxShadowedItem& rShadow) { - SetValue(rShadow.GetValue()); - return *this; - } SvxShadowedItem(SvxShadowedItem const &) = default; // SfxPoolItem copy function dichotomy }; diff --git a/include/editeng/sizeitem.hxx b/include/editeng/sizeitem.hxx index ab2fb380a54f..bd4f86f7d070 100644 --- a/include/editeng/sizeitem.hxx +++ b/include/editeng/sizeitem.hxx @@ -41,9 +41,6 @@ public: explicit SvxSizeItem( const sal_uInt16 nId ); SvxSizeItem( const sal_uInt16 nId, const Size& rSize); - inline SvxSizeItem& operator=( const SvxSizeItem &rCpy ); - SvxSizeItem(SvxSizeItem const &) = default; // SfxPoolItem copy function dichotomy - // "pure virtual Methods" from SfxPoolItem virtual bool operator==( const SfxPoolItem& ) const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; @@ -67,12 +64,6 @@ public: void SetHeight(long n) { m_aSize.setHeight(n); } }; -inline SvxSizeItem& SvxSizeItem::operator=( const SvxSizeItem &rCpy ) -{ - m_aSize = rCpy.m_aSize; - return *this; -} - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/tstpitem.hxx b/include/editeng/tstpitem.hxx index e434e9d5a961..a6f292107504 100644 --- a/include/editeng/tstpitem.hxx +++ b/include/editeng/tstpitem.hxx @@ -116,8 +116,6 @@ public: { maTabStops.erase( maTabStops.begin() + nPos, maTabStops.begin() + nPos + nLen ); } // Assignment operator, equality operator (caution: expensive!) - SvxTabStopItem& operator=( const SvxTabStopItem& rTSI ); - SvxTabStopItem(SvxTabStopItem const &) = default; // SfxPoolItem copy function dichotomy // this is already included in SfxPoolItem declaration //int operator!=( const SvxTabStopItem& rTSI ) const diff --git a/include/editeng/twolinesitem.hxx b/include/editeng/twolinesitem.hxx index 6f71c09391ff..8ec80758bcec 100644 --- a/include/editeng/twolinesitem.hxx +++ b/include/editeng/twolinesitem.hxx @@ -51,8 +51,6 @@ public: virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFFVer ) const override; - bool GetValue() const { return bOn; } sal_Unicode GetStartBracket() const { return cStartBracket; } diff --git a/include/editeng/udlnitem.hxx b/include/editeng/udlnitem.hxx index b4fef4612f80..386a28544c29 100644 --- a/include/editeng/udlnitem.hxx +++ b/include/editeng/udlnitem.hxx @@ -42,8 +42,6 @@ public: OUString &rText, const IntlWrapper& ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const override; - virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const override; virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const; virtual sal_uInt16 GetValueCount() const override; @@ -57,14 +55,6 @@ public: virtual bool operator==( const SfxPoolItem& ) const override; - SvxTextLineItem& operator=(const SvxTextLineItem& rTextLine) - { - SetValue( rTextLine.GetValue() ); - SetColor( rTextLine.GetColor() ); - return *this; - } - SvxTextLineItem(SvxTextLineItem const &) = default; // SfxPoolItem copy function dichotomy - // enum cast FontLineStyle GetLineStyle() const { return GetValue(); } @@ -88,7 +78,6 @@ public: const sal_uInt16 nId ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const override; virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const override; }; @@ -105,7 +94,6 @@ public: const sal_uInt16 nId ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const override; virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const override; }; diff --git a/include/editeng/ulspitem.hxx b/include/editeng/ulspitem.hxx index cfcfbb6f330f..2199d6f636bd 100644 --- a/include/editeng/ulspitem.hxx +++ b/include/editeng/ulspitem.hxx @@ -44,8 +44,6 @@ public: explicit SvxULSpaceItem( const sal_uInt16 nId ); SvxULSpaceItem( const sal_uInt16 nUp, const sal_uInt16 nLow, const sal_uInt16 nId ); - inline SvxULSpaceItem& operator=( const SvxULSpaceItem &rCpy ); - SvxULSpaceItem(SvxULSpaceItem const &) = default; // SfxPoolItem copy function dichotomy // "pure virtual Methods" from SfxPoolItem virtual bool operator==( const SfxPoolItem& ) const override; @@ -59,7 +57,6 @@ public: OUString &rText, const IntlWrapper& ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const override; virtual void ScaleMetrics( long nMult, long nDiv ) override; virtual bool HasMetrics() const override; @@ -80,16 +77,6 @@ public: void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; -inline SvxULSpaceItem &SvxULSpaceItem::operator=( const SvxULSpaceItem &rCpy ) -{ - nUpper = rCpy.GetUpper(); - nLower = rCpy.GetLower(); - bContext = rCpy.GetContext(); - nPropUpper = rCpy.GetPropUpper(); - nPropLower = rCpy.GetPropLower(); - return *this; -} - inline void SvxULSpaceItem::SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp ) { nUpper = sal_uInt16((sal_uInt32(nU) * nProp ) / 100); nPropUpper = nProp; diff --git a/include/editeng/wghtitem.hxx b/include/editeng/wghtitem.hxx index 18d5e4f4af55..a718a3bfd387 100644 --- a/include/editeng/wghtitem.hxx +++ b/include/editeng/wghtitem.hxx @@ -45,8 +45,6 @@ public: OUString &rText, const IntlWrapper& ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const override; - virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const override; static OUString GetValueTextByPos( sal_uInt16 nPos ); virtual sal_uInt16 GetValueCount() const override; @@ -57,12 +55,6 @@ public: virtual bool GetBoolValue() const override; virtual void SetBoolValue( bool bVal ) override; - SvxWeightItem& operator=(const SvxWeightItem& rWeight) { - SetValue( rWeight.GetValue() ); - return *this; - } - SvxWeightItem(SvxWeightItem const &) = default; // SfxPoolItem copy function dichotomy - // enum cast FontWeight GetWeight() const { return GetValue(); } diff --git a/include/editeng/writingmodeitem.hxx b/include/editeng/writingmodeitem.hxx index 6c10ef62f0f5..6bdf02fe6986 100644 --- a/include/editeng/writingmodeitem.hxx +++ b/include/editeng/writingmodeitem.hxx @@ -38,7 +38,6 @@ public: SvxWritingModeItem & operator =(SvxWritingModeItem &&) = delete; // due to SfxUInt16Item virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const override; virtual bool operator==( const SfxPoolItem& ) const override; css::text::WritingMode GetValue() const { return static_cast<css::text::WritingMode>(SfxUInt16Item::GetValue()); } diff --git a/include/editeng/xmlcnitm.hxx b/include/editeng/xmlcnitm.hxx index d66c254523cc..61d883e3d497 100644 --- a/include/editeng/xmlcnitm.hxx +++ b/include/editeng/xmlcnitm.hxx @@ -45,8 +45,6 @@ public: OUString &rText, const IntlWrapper& rIntlWrapper) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const override; - virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; diff --git a/include/sfx2/evntconf.hxx b/include/sfx2/evntconf.hxx index efd330260f53..7dad7c8f8053 100644 --- a/include/sfx2/evntconf.hxx +++ b/include/sfx2/evntconf.hxx @@ -78,7 +78,6 @@ public: OUString &rText, const IntlWrapper& ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const override; const SfxEventNamesList& GetEvents() const { return aEventsList;} void AddEvent( const OUString&, const OUString&, SvMacroItemId ); diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx index d4eb1fb71ae1..80cb3faade16 100644 --- a/include/sfx2/tabdlg.hxx +++ b/include/sfx2/tabdlg.hxx @@ -49,7 +49,6 @@ public: SfxTabDialogItem( sal_uInt16 nId, const SfxItemSet& rItemSet ); SfxTabDialogItem(const SfxTabDialogItem& rAttr, SfxItemPool* pItemPool); virtual SfxPoolItem* Clone(SfxItemPool* pToPool = nullptr) const override; - virtual SfxPoolItem* Create(SvStream& rStream, sal_uInt16 nVersion) const override; }; class SFX2_DLLPUBLIC SfxTabDialog : public TabDialog diff --git a/include/svl/aeitem.hxx b/include/svl/aeitem.hxx index d69b1f086f4b..621468f32988 100644 --- a/include/svl/aeitem.hxx +++ b/include/svl/aeitem.hxx @@ -33,10 +33,6 @@ protected: explicit SfxAllEnumItem_Base(sal_uInt16 nWhich, sal_uInt16 nValue): SfxEnumItem(nWhich, nValue) {} - - explicit SfxAllEnumItem_Base(sal_uInt16 const nWhich, SvStream & rStream): - SfxEnumItem(nWhich, rStream) - {} }; class SVL_DLLPUBLIC SfxAllEnumItem: public SfxAllEnumItem_Base @@ -49,7 +45,6 @@ class SVL_DLLPUBLIC SfxAllEnumItem: public SfxAllEnumItem_Base public: explicit SfxAllEnumItem( sal_uInt16 nWhich); SfxAllEnumItem( sal_uInt16 nWhich, sal_uInt16 nVal ); - SfxAllEnumItem( sal_uInt16 nWhich, SvStream &rStream ); SfxAllEnumItem( const SfxAllEnumItem & ); virtual ~SfxAllEnumItem() override; @@ -61,7 +56,6 @@ public: sal_uInt16 GetValueByPos( sal_uInt16 nPos ) const; OUString const & GetValueTextByPos( sal_uInt16 nPos ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SfxPoolItem* Create(SvStream &, sal_uInt16 nVersion) const override; }; #endif diff --git a/include/svl/cintitem.hxx b/include/svl/cintitem.hxx index f8e1ea3f0fa3..5176d150629c 100644 --- a/include/svl/cintitem.hxx +++ b/include/svl/cintitem.hxx @@ -47,10 +47,6 @@ public: virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override; - virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const override; - - virtual SvStream & Store(SvStream & rStream, sal_uInt16) const override; - virtual SfxPoolItem * Clone(SfxItemPool * = nullptr) const override; sal_uInt8 GetValue() const { return m_nValue; } @@ -74,8 +70,6 @@ public: SfxPoolItem(which), m_nValue(nTheValue) {} - CntUInt16Item(sal_uInt16 which, SvStream & rStream); - virtual bool operator ==(const SfxPoolItem & rItem) const override; virtual bool GetPresentation(SfxItemPresentation, @@ -90,10 +84,6 @@ public: virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override; - virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const override; - - virtual SvStream & Store(SvStream & rStream, sal_uInt16) const override; - virtual SfxPoolItem * Clone(SfxItemPool * = nullptr) const override; sal_uInt16 GetValue() const { return m_nValue; } @@ -117,8 +107,6 @@ public: SfxPoolItem(which), m_nValue(nTheValue) {} - CntInt32Item(sal_uInt16 which, SvStream & rStream); - virtual bool operator ==(const SfxPoolItem & rItem) const override; virtual bool GetPresentation(SfxItemPresentation, @@ -133,10 +121,6 @@ public: virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override; - virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const override; - - virtual SvStream & Store(SvStream &, sal_uInt16) const override; - virtual SfxPoolItem * Clone(SfxItemPool * = nullptr) const override; sal_Int32 GetValue() const { return m_nValue; } @@ -160,8 +144,6 @@ public: SfxPoolItem(which), m_nValue(nTheValue) {} - CntUInt32Item(sal_uInt16 nWhich, SvStream & rStream); - virtual bool operator ==(const SfxPoolItem & rItem) const override; virtual bool GetPresentation(SfxItemPresentation, @@ -176,10 +158,6 @@ public: virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override; - virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const override; - - virtual SvStream & Store(SvStream & rStream, sal_uInt16) const override; - virtual SfxPoolItem * Clone(SfxItemPool * = nullptr) const override; sal_uInt32 GetValue() const { return m_nValue; } diff --git a/include/svl/eitem.hxx b/include/svl/eitem.hxx index 268df41d6f4a..eadf1321b8a9 100644 --- a/include/svl/eitem.hxx +++ b/include/svl/eitem.hxx @@ -38,14 +38,6 @@ protected: SfxEnumItem(const SfxEnumItem &) = default; - SfxEnumItem(sal_uInt16 const nWhich, SvStream & rStream) - : SfxEnumItemInterface(nWhich) - { - sal_uInt16 nTmp = 0; - rStream.ReadUInt16( nTmp ); - m_nValue = static_cast<EnumT>(nTmp); - } - public: EnumT GetValue() const { return m_nValue; } @@ -56,12 +48,6 @@ public: m_nValue = nTheValue; } - virtual SvStream & Store(SvStream & rStream, sal_uInt16) const override - { - rStream.WriteUInt16( static_cast<sal_uInt16>(m_nValue) ); - return rStream; - } - virtual sal_uInt16 GetEnumValue() const override { return static_cast<sal_uInt16>(GetValue()); @@ -114,11 +100,6 @@ public: virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8) override; - virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const - override; - - virtual SvStream & Store(SvStream & rStream, sal_uInt16) const override; - virtual SfxPoolItem * Clone(SfxItemPool * = nullptr) const override; virtual OUString GetValueTextByVal(bool bTheValue) const; diff --git a/include/svl/flagitem.hxx b/include/svl/flagitem.hxx index f37a9e5ef548..db061e38c326 100644 --- a/include/svl/flagitem.hxx +++ b/include/svl/flagitem.hxx @@ -36,8 +36,6 @@ public: virtual sal_uInt8 GetFlagCount() const; virtual bool operator==( const SfxPoolItem& ) const override; - virtual SfxPoolItem* Create(SvStream &, sal_uInt16 nVersion) const override; - virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, diff --git a/include/svl/int64item.hxx b/include/svl/int64item.hxx index 410beb21746b..428381b340a5 100644 --- a/include/svl/int64item.hxx +++ b/include/svl/int64item.hxx @@ -19,7 +19,6 @@ class SVL_DLLPUBLIC SfxInt64Item : public SfxPoolItem public: SfxInt64Item( sal_uInt16 nWhich, sal_Int64 nVal ); - SfxInt64Item( sal_uInt16 nWhich, SvStream & rStream ); virtual ~SfxInt64Item() override; @@ -40,10 +39,6 @@ public: virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; - virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nItemVersion ) const override; - - virtual SvStream& Store( SvStream& rStream, sal_uInt16 nItemVersion ) const override; - virtual SfxPoolItem* Clone( SfxItemPool* pOther = nullptr ) const override; sal_Int64 GetValue() const { return mnValue;} diff --git a/include/svl/intitem.hxx b/include/svl/intitem.hxx index a4c14ebd863f..f6064ed8a335 100644 --- a/include/svl/intitem.hxx +++ b/include/svl/intitem.hxx @@ -32,8 +32,6 @@ public: explicit SfxByteItem(sal_uInt16 which = 0, sal_uInt8 nValue = 0): CntByteItem(which, nValue) {} - virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const override; - virtual SfxPoolItem * Clone(SfxItemPool * = nullptr) const override { return new SfxByteItem(*this); } }; @@ -49,8 +47,6 @@ public: SfxPoolItem(which), m_nValue(nTheValue) {} - SfxInt16Item(sal_uInt16 nWhich, SvStream & rStream); - virtual bool operator ==(const SfxPoolItem & rItem) const override; virtual bool GetPresentation(SfxItemPresentation, @@ -65,10 +61,6 @@ public: virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; - virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const override; - - virtual SvStream & Store(SvStream & rStream, sal_uInt16) const override; - virtual SfxPoolItem * Clone(SfxItemPool * = nullptr) const override; sal_Int16 GetValue() const { return m_nValue; } @@ -91,12 +83,6 @@ public: explicit SfxUInt16Item(sal_uInt16 which = 0, sal_uInt16 nValue = 0): CntUInt16Item(which, nValue) {} - SfxUInt16Item(sal_uInt16 which, SvStream & rStream): - CntUInt16Item(which, rStream) {} - - virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const override - { return new SfxUInt16Item(Which(), rStream); } - virtual SfxPoolItem * Clone(SfxItemPool * = nullptr) const override { return new SfxUInt16Item(*this); } @@ -112,12 +98,6 @@ public: explicit SfxInt32Item(sal_uInt16 which = 0, sal_Int32 nValue = 0): CntInt32Item(which, nValue) {} - SfxInt32Item(sal_uInt16 which, SvStream & rStream): - CntInt32Item(which, rStream) {} - - virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const override - { return new SfxInt32Item(Which(), rStream); } - virtual SfxPoolItem * Clone(SfxItemPool * = nullptr) const override { return new SfxInt32Item(*this); } @@ -133,12 +113,6 @@ public: explicit SfxUInt32Item(sal_uInt16 which = 0, sal_uInt32 nValue = 0): CntUInt32Item(which, nValue) {} - SfxUInt32Item(sal_uInt16 which, SvStream & rStream): - CntUInt32Item(which, rStream) {} - - virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const override - { return new SfxUInt32Item(Which(), rStream); } - virtual SfxPoolItem * Clone(SfxItemPool * = nullptr) const override { return new SfxUInt32Item(*this); } diff --git a/include/svl/lckbitem.hxx b/include/svl/lckbitem.hxx index d6bf1a21e27c..331854a56d9a 100644 --- a/include/svl/lckbitem.hxx +++ b/include/svl/lckbitem.hxx @@ -30,7 +30,6 @@ class SVL_DLLPUBLIC SfxLockBytesItem : public SfxPoolItem public: static SfxPoolItem* CreateDefault(); SfxLockBytesItem(); - SfxLockBytesItem( sal_uInt16 nWhich, SvStream & ); virtual ~SfxLockBytesItem() override; SfxLockBytesItem(SfxLockBytesItem const &) = default; @@ -40,8 +39,6 @@ public: virtual bool operator==( const SfxPoolItem& ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SfxPoolItem* Create(SvStream &, sal_uInt16 nItemVersion) const override; - virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const override; SvLockBytes* GetValue() const { return _xVal.get(); } diff --git a/include/svl/legacyitem.hxx b/include/svl/legacyitem.hxx new file mode 100755 index 000000000000..b2035aecaf9b --- /dev/null +++ b/include/svl/legacyitem.hxx @@ -0,0 +1,52 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SVL_LEGACYITEM_HXX +#define INCLUDED_SVL_LEGACYITEM_HXX + +#include <svl/svldllapi.h> + +////////////////////////////////////////////////////////////////////////////// +// // svl +// SfxBoolItem aLinebreak; +// SfxInt32Item aRotateAngle; -> CntInt32Item +////////////////////////////////////////////////////////////////////////////// + +class SvStream; +class SfxBoolItem; +class CntInt32Item; + +namespace legacy +{ + namespace SfxBool + { + sal_uInt16 SVL_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion); + void SVL_DLLPUBLIC Create(SfxBoolItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + SVL_DLLPUBLIC SvStream& Store(const SfxBoolItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + namespace CntInt32 + { + sal_uInt16 SVL_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion); + void SVL_DLLPUBLIC Create(CntInt32Item& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + SVL_DLLPUBLIC SvStream& Store(const CntInt32Item& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } +} + +#endif // INCLUDED_SVL_LEGACYITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svl/macitem.hxx b/include/svl/macitem.hxx index 7d17b3349dd3..a397cc6e3bb4 100644 --- a/include/svl/macitem.hxx +++ b/include/svl/macitem.hxx @@ -125,7 +125,6 @@ public: OUString &rText, const IntlWrapper& ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const override; const SvxMacroTableDtor& GetMacroTable() const { return aMacroTable;} void SetMacroTable( const SvxMacroTableDtor& rTbl ) { aMacroTable = rTbl; } diff --git a/include/svl/poolitem.hxx b/include/svl/poolitem.hxx index c3800cc02c18..796d6aa476c9 100644 --- a/include/svl/poolitem.hxx +++ b/include/svl/poolitem.hxx @@ -31,7 +31,6 @@ #include <tools/mapunit.hxx> class IntlWrapper; -class SvStream; enum class SfxItemKind : sal_Int8 { @@ -164,15 +163,12 @@ public: OUString &rText, const IntlWrapper& rIntlWrapper ) const; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const; virtual void ScaleMetrics( long lMult, long lDiv ); virtual bool HasMetrics() const; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ); - virtual SfxPoolItem* Create( SvStream &, sal_uInt16 nItemVersion ) const; - virtual SvStream& Store( SvStream &, sal_uInt16 nItemVersion ) const; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const = 0; // clone and call SetWhich std::unique_ptr<SfxPoolItem> CloneSetWhich( sal_uInt16 nNewWhich ) const; diff --git a/include/svl/ptitem.hxx b/include/svl/ptitem.hxx index 76e5022c441b..348d427d763f 100644 --- a/include/svl/ptitem.hxx +++ b/include/svl/ptitem.hxx @@ -44,8 +44,6 @@ public: virtual bool operator==( const SfxPoolItem& ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SfxPoolItem* Create(SvStream &, sal_uInt16 nItemVersion) const override; - virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const override; const Point& GetValue() const { return aVal; } void SetValue( const Point& rNewVal ) { diff --git a/include/svl/rectitem.hxx b/include/svl/rectitem.hxx index 3dd119e1d089..412a695be464 100644 --- a/include/svl/rectitem.hxx +++ b/include/svl/rectitem.hxx @@ -42,8 +42,6 @@ public: virtual bool operator==( const SfxPoolItem& ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SfxPoolItem* Create(SvStream &, sal_uInt16 nItemVersion) const override; - virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const override; const tools::Rectangle& GetValue() const { return aVal; } virtual bool QueryValue( css::uno::Any& rVal, diff --git a/include/svl/rngitem.hxx b/include/svl/rngitem.hxx index 316b9c334f3d..de2d64d9c34c 100644 --- a/include/svl/rngitem.hxx +++ b/include/svl/rngitem.hxx @@ -41,8 +41,6 @@ public: const IntlWrapper& ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; sal_uInt16& From() { return nFrom; } - virtual SfxPoolItem* Create( SvStream &, sal_uInt16 nVersion ) const override; - virtual SvStream& Store( SvStream &, sal_uInt16 nItemVersion ) const override; }; diff --git a/include/svl/slstitm.hxx b/include/svl/slstitm.hxx index dc803e69103d..872903f3c7d8 100644 --- a/include/svl/slstitm.hxx +++ b/include/svl/slstitm.hxx @@ -36,7 +36,6 @@ public: SfxStringListItem(); SfxStringListItem( sal_uInt16 nWhich, const std::vector<OUString> *pList=nullptr ); - SfxStringListItem( sal_uInt16 nWhich, SvStream& rStream ); virtual ~SfxStringListItem() override; SfxStringListItem(SfxStringListItem const &) = default; @@ -62,8 +61,6 @@ public: OUString &rText, const IntlWrapper& ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SfxPoolItem* Create( SvStream &, sal_uInt16 nVersion ) const override; - virtual SvStream& Store( SvStream &, sal_uInt16 nItemVersion ) const override; virtual bool PutValue ( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; diff --git a/include/svl/stritem.hxx b/include/svl/stritem.hxx index 2103e917ee13..37546d88b4b2 100644 --- a/include/svl/stritem.hxx +++ b/include/svl/stritem.hxx @@ -34,12 +34,6 @@ public: SfxStringItem(sal_uInt16 which, const OUString & rValue): CntUnencodedStringItem(which, rValue) {} - SfxStringItem(sal_uInt16 nWhich, SvStream & rStream); - - virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const override; - - virtual SvStream & Store(SvStream & rStream, sal_uInt16) const override; - virtual SfxPoolItem * Clone(SfxItemPool * = nullptr) const override; void dumpAsXml(xmlTextWriterPtr pWriter) const override; diff --git a/include/svl/visitem.hxx b/include/svl/visitem.hxx index af382c426bc3..f83274644fdb 100644 --- a/include/svl/visitem.hxx +++ b/include/svl/visitem.hxx @@ -36,8 +36,6 @@ public: m_nValue.bVisible = bVisible; } - SfxVisibilityItem(sal_uInt16 which, SvStream & rStream); - virtual bool operator ==(const SfxPoolItem & rItem) const override; virtual bool GetPresentation(SfxItemPresentation, MapUnit, MapUnit, @@ -51,10 +49,6 @@ public: virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; - virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const override; - - virtual SvStream & Store(SvStream & rStream, sal_uInt16) const override; - virtual SfxPoolItem * Clone(SfxItemPool * = nullptr) const override; bool GetValue() const { return m_nValue.bVisible; } diff --git a/include/svx/algitem.hxx b/include/svx/algitem.hxx index b1cc5f70ec77..ee6eee0bec89 100644 --- a/include/svx/algitem.hxx +++ b/include/svx/algitem.hxx @@ -29,7 +29,6 @@ class IntlWrapper; class SfxItemPool; -class SvStream; class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxOrientationItem: public SfxEnumItem<SvxCellOrientation> { @@ -53,14 +52,6 @@ public: virtual sal_uInt16 GetValueCount() const override; static OUString GetValueText( SvxCellOrientation nVal ); virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const override; - - SvxOrientationItem& operator=(const SvxOrientationItem& rOrientation) - { - SetValue( rOrientation.GetValue() ); - return *this; - } - SvxOrientationItem(SvxOrientationItem const &) = default; // SfxPoolItem copy function dichotomy /** Returns sal_True, if the item represents STACKED state. */ bool IsStacked() const; @@ -88,8 +79,6 @@ public: virtual bool operator==( const SfxPoolItem& ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const override; - virtual SvStream& Store( SvStream&, sal_uInt16 nItemVersion ) const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; @@ -102,16 +91,6 @@ public: void SetRightMargin(sal_Int16 nRight); sal_Int16 GetBottomMargin() const {return nBottomMargin; } void SetBottomMargin(sal_Int16 nBottom); - - SvxMarginItem& operator=(const SvxMarginItem& rMargin) - { - nLeftMargin = rMargin.nLeftMargin; - nTopMargin = rMargin.nTopMargin; - nRightMargin = rMargin.nRightMargin; - nBottomMargin = rMargin.nBottomMargin; - return *this; - } - SvxMarginItem(SvxMarginItem const &) = default; // SfxPoolItem copy function dichotomy }; #endif diff --git a/include/svx/autoformathelper.hxx b/include/svx/autoformathelper.hxx new file mode 100755 index 000000000000..a2d72646cbce --- /dev/null +++ b/include/svx/autoformathelper.hxx @@ -0,0 +1,218 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SVX_AUTOFORMATHELPER_HXX +#define INCLUDED_SVX_AUTOFORMATHELPER_HXX + +#include <svx/svxdllapi.h> +#include <memory> + +class SvStream; +class SvxFontItem; +class SvxFontHeightItem; +class SvxWeightItem; +class SvxPostureItem; +class SvxUnderlineItem; +class SvxOverlineItem; +class SvxCrossedOutItem; +class SvxContourItem; +class SvxShadowedItem; +class SvxColorItem; +class SvxBoxItem; +class SvxLineItem; +class SvxBrushItem; +class SvxAdjustItem; +class SvxHorJustifyItem; +class SvxVerJustifyItem; +class SfxBoolItem; +class SvxMarginItem; +class SfxInt32Item; +class SvxRotateModeItem; + +////////////////////////////////////////////////////////////////////////////// +/// Struct with version numbers of the Items + +struct SVX_DLLPUBLIC AutoFormatVersions +{ +public: + // BlockA + 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; + + // BlockB + sal_uInt16 nHorJustifyVersion; + sal_uInt16 nVerJustifyVersion; + sal_uInt16 nOrientationVersion; + sal_uInt16 nMarginVersion; + sal_uInt16 nBoolVersion; + sal_uInt16 nInt32Version; + sal_uInt16 nRotateModeVersion; + sal_uInt16 nNumFormatVersion; + + AutoFormatVersions(); + + void LoadBlockA( SvStream& rStream, sal_uInt16 nVer ); + void LoadBlockB( SvStream& rStream, sal_uInt16 nVer ); + + static void WriteBlockA(SvStream& rStream, sal_uInt16 fileVersion); + static void WriteBlockB(SvStream& rStream, sal_uInt16 fileVersion); +}; + +////////////////////////////////////////////////////////////////////////////// + +class SVX_DLLPUBLIC AutoFormatBase +{ +protected: + // common attributes of Calc and Writer + // --- from 641 on: CJK and CTL font settings + std::shared_ptr<SvxFontItem> m_aFont; + std::shared_ptr<SvxFontHeightItem> m_aHeight; + std::shared_ptr<SvxWeightItem> m_aWeight; + std::shared_ptr<SvxPostureItem> m_aPosture; + + std::shared_ptr<SvxFontItem> m_aCJKFont; + std::shared_ptr<SvxFontHeightItem> m_aCJKHeight; + std::shared_ptr<SvxWeightItem> m_aCJKWeight; + std::shared_ptr<SvxPostureItem> m_aCJKPosture; + + std::shared_ptr<SvxFontItem> m_aCTLFont; + std::shared_ptr<SvxFontHeightItem> m_aCTLHeight; + std::shared_ptr<SvxWeightItem> m_aCTLWeight; + std::shared_ptr<SvxPostureItem> m_aCTLPosture; + + std::shared_ptr<SvxUnderlineItem> m_aUnderline; + std::shared_ptr<SvxOverlineItem> m_aOverline; + std::shared_ptr<SvxCrossedOutItem> m_aCrossedOut; + std::shared_ptr<SvxContourItem> m_aContour; + std::shared_ptr<SvxShadowedItem> m_aShadowed; + std::shared_ptr<SvxColorItem> m_aColor; + std::shared_ptr<SvxBoxItem> m_aBox; + std::shared_ptr<SvxLineItem> m_aTLBR; + std::shared_ptr<SvxLineItem> m_aBLTR; + std::shared_ptr<SvxBrushItem> m_aBackground; + + // Writer specific + std::shared_ptr<SvxAdjustItem> m_aAdjust; + + // Calc specific + std::shared_ptr<SvxHorJustifyItem> m_aHorJustify; + std::shared_ptr<SvxVerJustifyItem> m_aVerJustify; + std::shared_ptr<SfxBoolItem> m_aStacked; + std::shared_ptr<SvxMarginItem> m_aMargin; + std::shared_ptr<SfxBoolItem> m_aLinebreak; + + // from SO5, 504k on, rotated text + std::shared_ptr<SfxInt32Item> m_aRotateAngle; + std::shared_ptr<SvxRotateModeItem> m_aRotateMode; + +public: + AutoFormatBase(); + AutoFormatBase( const AutoFormatBase& rNew ); + ~AutoFormatBase(); + + /// Comparing based of boxes backgrounds. + bool operator==(const AutoFormatBase& rRight); + + // The get-methods. + const SvxFontItem &GetFont() const { return *m_aFont; } + const SvxFontHeightItem &GetHeight() const { return *m_aHeight; } + const SvxWeightItem &GetWeight() const { return *m_aWeight; } + const SvxPostureItem &GetPosture() const { return *m_aPosture; } + const SvxFontItem &GetCJKFont() const { return *m_aCJKFont; } + const SvxFontHeightItem &GetCJKHeight() const { return *m_aCJKHeight; } + const SvxWeightItem &GetCJKWeight() const { return *m_aCJKWeight; } + const SvxPostureItem &GetCJKPosture() const { return *m_aCJKPosture; } + const SvxFontItem &GetCTLFont() const { return *m_aCTLFont; } + const SvxFontHeightItem &GetCTLHeight() const { return *m_aCTLHeight; } + const SvxWeightItem &GetCTLWeight() const { return *m_aCTLWeight; } + const SvxPostureItem &GetCTLPosture() const { return *m_aCTLPosture; } + const SvxUnderlineItem &GetUnderline() const { return *m_aUnderline; } + const SvxOverlineItem &GetOverline() const { return *m_aOverline; } + const SvxCrossedOutItem &GetCrossedOut() const { return *m_aCrossedOut; } + const SvxContourItem &GetContour() const { return *m_aContour; } + const SvxShadowedItem &GetShadowed() const { return *m_aShadowed; } + const SvxColorItem &GetColor() const { return *m_aColor; } + const SvxBoxItem &GetBox() const { return *m_aBox; } + const SvxLineItem& GetTLBR() const { return *m_aTLBR; } + const SvxLineItem& GetBLTR() const { return *m_aBLTR; } + const SvxBrushItem &GetBackground() const { return *m_aBackground; } + const SvxAdjustItem &GetAdjust() const { return *m_aAdjust; } + const SvxHorJustifyItem& GetHorJustify() const { return *m_aHorJustify; } + const SvxVerJustifyItem& GetVerJustify() const { return *m_aVerJustify; } + const SfxBoolItem& GetStacked() const { return *m_aStacked; } + const SvxMarginItem& GetMargin() const { return *m_aMargin; } + const SfxBoolItem& GetLinebreak() const { return *m_aLinebreak; } + const SfxInt32Item& GetRotateAngle() const { return *m_aRotateAngle; } + const SvxRotateModeItem& GetRotateMode() const { return *m_aRotateMode; } + + // The set-methods. + void SetFont( const SvxFontItem& rNew ); + void SetHeight( const SvxFontHeightItem& rNew ); + void SetWeight( const SvxWeightItem& rNew ); + void SetPosture( const SvxPostureItem& rNew ); + void SetCJKFont( const SvxFontItem& rNew ); + void SetCJKHeight( const SvxFontHeightItem& rNew ); + void SetCJKWeight( const SvxWeightItem& rNew ); + void SetCJKPosture( const SvxPostureItem& rNew ); + void SetCTLFont( const SvxFontItem& rNew ); + void SetCTLHeight( const SvxFontHeightItem& rNew ); + void SetCTLWeight( const SvxWeightItem& rNew ); + void SetCTLPosture( const SvxPostureItem& rNew ); + void SetUnderline( const SvxUnderlineItem& rNew ); + void SetOverline( const SvxOverlineItem& rNew ); + void SetCrossedOut( const SvxCrossedOutItem& rNew ); + void SetContour( const SvxContourItem& rNew ); + void SetShadowed( const SvxShadowedItem& rNew ); + void SetColor( const SvxColorItem& rNew ); + void SetBox( const SvxBoxItem& rNew ); + void SetTLBR( const SvxLineItem& rNew ); + void SetBLTR( const SvxLineItem& rNew ); + void SetBackground( const SvxBrushItem& rNew ); + void SetAdjust( const SvxAdjustItem& rNew ); + void SetHorJustify( const SvxHorJustifyItem& rNew ); + void SetVerJustify( const SvxVerJustifyItem& rNew ); + void SetStacked( const SfxBoolItem& rNew ); + void SetMargin( const SvxMarginItem& rNew ); + void SetLinebreak( const SfxBoolItem& rNew ); + void SetRotateAngle( const SfxInt32Item& rNew ); + void SetRotateMode( const SvxRotateModeItem& rNew ); + + bool LoadBlockA( SvStream& rStream, const AutoFormatVersions& rVersions, sal_uInt16 nVer ); + bool LoadBlockB( SvStream& rStream, const AutoFormatVersions& rVersions, sal_uInt16 nVer ); + + bool SaveBlockA( SvStream& rStream, sal_uInt16 fileVersion ) const; + bool SaveBlockB( SvStream& rStream, sal_uInt16 fileVersion ) const; +}; + +#endif // INCLUDED_SVX_AUTOFORMATHELPER_HXX + +////////////////////////////////////////////////////////////////////////////// +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/chrtitem.hxx b/include/svx/chrtitem.hxx index d852cd10f0dc..5accfe78e0f9 100644 --- a/include/svx/chrtitem.hxx +++ b/include/svx/chrtitem.hxx @@ -88,7 +88,6 @@ public: virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override; sal_uInt16 GetValueCount() const override { return CHREGRESS_COUNT; } - sal_uInt16 GetVersion (sal_uInt16 nFileFormatVersion) const override; }; class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxChartTextOrderItem : public SfxEnumItem<SvxChartTextOrder> @@ -114,8 +113,6 @@ public: virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override; sal_uInt16 GetValueCount() const override { return CHERROR_COUNT; } - - sal_uInt16 GetVersion (sal_uInt16 nFileFormatVersion) const override; }; class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxChartIndicateItem : public SfxEnumItem<SvxChartIndicate> @@ -127,8 +124,6 @@ public: virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override; sal_uInt16 GetValueCount() const override { return CHINDICATE_COUNT; } - - sal_uInt16 GetVersion (sal_uInt16 nFileFormatVersion) const override; }; class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxDoubleItem : public SfxPoolItem diff --git a/include/svx/e3ditem.hxx b/include/svx/e3ditem.hxx index 714d9c5fe3ef..47e033d7b1a5 100644 --- a/include/svx/e3ditem.hxx +++ b/include/svx/e3ditem.hxx @@ -43,8 +43,6 @@ public: const basegfx::B3DVector& GetValue() const { return aVal; } - virtual sal_uInt16 GetVersion (sal_uInt16 nFileFormatVersion) const override; - void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; diff --git a/include/svx/hlnkitem.hxx b/include/svx/hlnkitem.hxx index 0762556f2428..f51749e0d448 100644 --- a/include/svx/hlnkitem.hxx +++ b/include/svx/hlnkitem.hxx @@ -69,8 +69,6 @@ public: HyperDialogEvent nEvents, SvxMacroTableDtor const *pMacroTbl ); - inline SvxHyperlinkItem& operator=( const SvxHyperlinkItem &rItem ); - virtual bool operator==( const SfxPoolItem& ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; diff --git a/include/svx/legacyitem.hxx b/include/svx/legacyitem.hxx new file mode 100755 index 000000000000..e75d8186aefa --- /dev/null +++ b/include/svx/legacyitem.hxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SVX_LEGACYITEM_HXX +#define INCLUDED_SVX_LEGACYITEM_HXX + +#include <svx/svxdllapi.h> + +////////////////////////////////////////////////////////////////////////////// +// // svx +// SvxOrientationItem aOrientation( aRotateAngle.GetValue(), aStacked.GetValue(), 0 ); +// SvxMarginItem aMargin; +// SvxRotateModeItem aRotateMode; +////////////////////////////////////////////////////////////////////////////// + +class SvStream; +class SvxOrientationItem; +class SvxMarginItem; +class SvxRotateModeItem; + +namespace legacy +{ + namespace SvxOrientation + { + sal_uInt16 SVX_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion); + void SVX_DLLPUBLIC Create(SvxOrientationItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + SVX_DLLPUBLIC SvStream& Store(const SvxOrientationItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + namespace SvxMargin + { + sal_uInt16 SVX_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion); + void SVX_DLLPUBLIC Create(SvxMarginItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + SVX_DLLPUBLIC SvStream& Store(const SvxMarginItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } + namespace SvxRotateMode + { + sal_uInt16 SVX_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion); + void SVX_DLLPUBLIC Create(SvxRotateModeItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + SVX_DLLPUBLIC SvStream& Store(const SvxRotateModeItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } +} + +#endif // INCLUDED_SVX_LEGACYITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/rotmodit.hxx b/include/svx/rotmodit.hxx index 7327880e0cd9..aa190a19dfa1 100644 --- a/include/svx/rotmodit.hxx +++ b/include/svx/rotmodit.hxx @@ -45,8 +45,6 @@ public: virtual sal_uInt16 GetValueCount() const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; - virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, diff --git a/include/svx/sdasitm.hxx b/include/svx/sdasitm.hxx index 3e2623b0ca76..b4014bdd8807 100644 --- a/include/svx/sdasitm.hxx +++ b/include/svx/sdasitm.hxx @@ -65,7 +65,6 @@ private: OUString &rText, const IntlWrapper&) const override; virtual SfxPoolItem* Clone( SfxItemPool* pPool = nullptr ) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; diff --git a/include/svx/sdgcpitm.hxx b/include/svx/sdgcpitm.hxx index 76d402814d60..26459d83c55d 100644 --- a/include/svx/sdgcpitm.hxx +++ b/include/svx/sdgcpitm.hxx @@ -37,7 +37,6 @@ public: SvxGrfCrop( nLeftCrop, nRightCrop, nTopCrop, nBottomCrop, SDRATTR_GRAFCROP ) {} virtual SfxPoolItem* Clone( SfxItemPool* pPool = nullptr ) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const override; }; #endif // INCLUDED_SVX_SDGCPITM_HXX diff --git a/include/svx/sdtacitm.hxx b/include/svx/sdtacitm.hxx index 056a5e79bb6a..43efa53c1826 100644 --- a/include/svx/sdtacitm.hxx +++ b/include/svx/sdtacitm.hxx @@ -26,10 +26,6 @@ class SdrTextAniCountItem: public SfxUInt16Item { public: SdrTextAniCountItem(sal_uInt16 nVal=0): SfxUInt16Item(SDRATTR_TEXT_ANICOUNT,nVal) {} - SdrTextAniCountItem(SvStream& rIn): SfxUInt16Item(SDRATTR_TEXT_ANICOUNT,rIn) {} - - virtual SfxPoolItem * Create(SvStream & rStream, sal_uInt16) const override - { return new SdrTextAniCountItem(rStream); } virtual SfxPoolItem * Clone(SfxItemPool * = nullptr) const override { return new SdrTextAniCountItem(*this); } diff --git a/include/svx/sdtfchim.hxx b/include/svx/sdtfchim.hxx index e00d3be87167..53198eb9d856 100644 --- a/include/svx/sdtfchim.hxx +++ b/include/svx/sdtfchim.hxx @@ -33,7 +33,6 @@ public: OUString &rText, const IntlWrapper&) const override; SVX_DLLPRIVATE virtual SfxPoolItem* Clone( SfxItemPool* pPool = nullptr ) const override; - SVX_DLLPRIVATE virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const override; SVX_DLLPRIVATE virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; SVX_DLLPRIVATE virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; diff --git a/include/svx/svx3ditems.hxx b/include/svx/svx3ditems.hxx index 11b4179b2d11..82ea78b09684 100644 --- a/include/svx/svx3ditems.hxx +++ b/include/svx/svx3ditems.hxx @@ -63,7 +63,6 @@ inline SfxBoolItem makeSvx3DDoubleSidedItem(bool bVal) { class Svx3DReducedLineGeometryItem : public SfxBoolItem { public: Svx3DReducedLineGeometryItem(bool bVal = false); - virtual sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion) const override; SfxPoolItem * Clone(SfxItemPool * = nullptr) const override; }; @@ -283,7 +282,6 @@ public: class Svx3DSmoothNormalsItem : public SfxBoolItem { public: Svx3DSmoothNormalsItem(bool bVal = true); - virtual sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion) const override; SfxPoolItem * Clone(SfxItemPool * = nullptr) const override; }; @@ -291,7 +289,6 @@ public: class Svx3DSmoothLidsItem : public SfxBoolItem { public: Svx3DSmoothLidsItem(bool bVal = false); - virtual sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion) const override; SfxPoolItem * Clone(SfxItemPool * = nullptr) const override; }; @@ -299,7 +296,6 @@ public: class Svx3DCharacterModeItem : public SfxBoolItem { public: Svx3DCharacterModeItem(bool bVal = false); - virtual sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion) const override; SfxPoolItem * Clone(SfxItemPool * = nullptr) const override; }; @@ -307,7 +303,6 @@ public: class SVX_DLLPUBLIC Svx3DCloseFrontItem : public SfxBoolItem { public: Svx3DCloseFrontItem(bool bVal = true); - SVX_DLLPRIVATE virtual sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion) const override; SfxPoolItem * Clone(SfxItemPool * = nullptr) const override; }; @@ -315,7 +310,6 @@ public: class SVX_DLLPUBLIC Svx3DCloseBackItem : public SfxBoolItem { public: Svx3DCloseBackItem(bool bVal = true); - SVX_DLLPRIVATE virtual sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion) const override; SfxPoolItem * Clone(SfxItemPool * = nullptr) const override; }; diff --git a/include/svx/unobrushitemhelper.hxx b/include/svx/unobrushitemhelper.hxx index b5ddc44c85c4..b3f7261f7708 100644 --- a/include/svx/unobrushitemhelper.hxx +++ b/include/svx/unobrushitemhelper.hxx @@ -43,7 +43,7 @@ SVX_DLLPUBLIC void setSvxBrushItemAsFillAttributesToTargetSet( // items in the range [XATTR_FILL_FIRST .. XATTR_FILL_LAST]. Since this is not 100% // representable this may lead to reduced data. With nBackgroundID a Which-ID for the // to-be-created SvxBrushItem has to be given (default should be 99 as in RES_BACKGROUND). -SVX_DLLPUBLIC SvxBrushItem getSvxBrushItemFromSourceSet( +SVX_DLLPUBLIC std::shared_ptr<SvxBrushItem> getSvxBrushItemFromSourceSet( const SfxItemSet& rSourceSet, sal_uInt16 nBackgroundID, bool bSearchInParents = true, diff --git a/include/svx/xbtmpit.hxx b/include/svx/xbtmpit.hxx index 7da764f7f9ac..bce24f860a4b 100644 --- a/include/svx/xbtmpit.hxx +++ b/include/svx/xbtmpit.hxx @@ -43,7 +43,6 @@ public: virtual bool operator==( const SfxPoolItem& rItem ) const override; virtual SfxPoolItem* Clone( SfxItemPool* pPool = nullptr ) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; diff --git a/include/svx/xflftrit.hxx b/include/svx/xflftrit.hxx index 95b29045631d..df78d6645bd7 100644 --- a/include/svx/xflftrit.hxx +++ b/include/svx/xflftrit.hxx @@ -43,7 +43,6 @@ public: virtual bool operator==( const SfxPoolItem& rItem ) const override; virtual SfxPoolItem* Clone( SfxItemPool* pPool = nullptr ) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; diff --git a/include/svx/xflgrit.hxx b/include/svx/xflgrit.hxx index 8f0424d23a74..159c6862dc79 100644 --- a/include/svx/xflgrit.hxx +++ b/include/svx/xflgrit.hxx @@ -43,7 +43,6 @@ public: virtual bool operator==(const SfxPoolItem& rItem) const override; virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override; - virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; diff --git a/include/svx/xlinjoit.hxx b/include/svx/xlinjoit.hxx index e56df6b4b997..b37aed1a45c0 100644 --- a/include/svx/xlinjoit.hxx +++ b/include/svx/xlinjoit.hxx @@ -35,7 +35,6 @@ public: static SfxPoolItem* CreateDefault(); XLineJointItem( css::drawing::LineJoint eLineJoint = css::drawing::LineJoint_ROUND ); - virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const override; virtual SfxPoolItem* Clone( SfxItemPool* pPool = nullptr ) const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; diff --git a/include/svx/xlncapit.hxx b/include/svx/xlncapit.hxx index 20f5ed09b912..57f49e07c015 100644 --- a/include/svx/xlncapit.hxx +++ b/include/svx/xlncapit.hxx @@ -35,7 +35,6 @@ public: static SfxPoolItem* CreateDefault(); XLineCapItem(css::drawing::LineCap eLineCap = css::drawing::LineCap_BUTT); - virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const override; virtual SfxPoolItem* Clone( SfxItemPool* pPool = nullptr ) const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; diff --git a/include/svx/xsflclit.hxx b/include/svx/xsflclit.hxx index 12ed0e004fd8..805665f2a003 100644 --- a/include/svx/xsflclit.hxx +++ b/include/svx/xsflclit.hxx @@ -36,9 +36,6 @@ public: MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper& ) const override; - - SVX_DLLPRIVATE virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const override; - }; #endif 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); } } diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 48b061e7caa5..5d690c8a1491 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -1201,7 +1201,7 @@ void SdImportTest::testPDFImport() void SdImportTest::testPDFImportSkipImages() { SfxAllItemSet *pParams = new SfxAllItemSet( SfxGetpApp()->GetPool() ); - pParams->Put( SfxStringItem ( SID_FILE_FILTEROPTIONS, OUString("SkipImages") ) ); + pParams->Put( SfxStringItem ( SID_FILE_FILTEROPTIONS, "SkipImages" ) ); sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pdf/txtpic.pdf"), PDF, pParams); SdDrawDocument *pDoc = xDocShRef->GetDoc(); diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx index 2f339b10aff7..d764c4299900 100644 --- a/sd/source/ui/table/TableDesignPane.cxx +++ b/sd/source/ui/table/TableDesignPane.cxx @@ -429,13 +429,13 @@ struct CellInfo { Color maCellColor; Color maTextColor; - SvxBoxItem maBorder; + std::shared_ptr<SvxBoxItem> maBorder; explicit CellInfo( const Reference< XStyle >& xStyle ); }; CellInfo::CellInfo( const Reference< XStyle >& xStyle ) -: maBorder(SDRATTR_TABLE_BORDER) +: maBorder(std::make_shared<SvxBoxItem>(SDRATTR_TABLE_BORDER)) { SfxStyleSheet* pStyleSheet = SfxUnoStyleSheet::getUnoStyleSheet( xStyle ); if( !pStyleSheet ) @@ -457,7 +457,7 @@ CellInfo::CellInfo( const Reference< XStyle >& xStyle ) // get border const SvxBoxItem* pBoxItem = rSet.GetItem( SDRATTR_TABLE_BORDER ); if( pBoxItem ) - maBorder = *pBoxItem; + maBorder.reset(static_cast<SvxBoxItem*>(pBoxItem->Clone())); } typedef std::vector< std::shared_ptr< CellInfo > > CellInfoVector; @@ -659,7 +659,7 @@ static const BitmapEx CreateDesignPreview( const Reference< XIndexAccess >& xTab // draw top border for( SvxBoxItemLine nLine : o3tl::enumrange<SvxBoxItemLine>() ) { - const ::editeng::SvxBorderLine* pBorderLine = xCellInfo->maBorder.GetLine(nLine); + const ::editeng::SvxBorderLine* pBorderLine = xCellInfo->maBorder->GetLine(nLine); if( !pBorderLine || ((pBorderLine->GetOutWidth() == 0) && (pBorderLine->GetInWidth()==0)) ) continue; @@ -671,7 +671,7 @@ static const BitmapEx CreateDesignPreview( const Reference< XIndexAccess >& xTab std::shared_ptr< CellInfo > xBorderInfo(aMatrix[(nBorderCol * nPreviewColumns) + nBorderRow]); if( xBorderInfo.get() ) { - const ::editeng::SvxBorderLine* pBorderLine2 = xBorderInfo->maBorder.GetLine(static_cast<SvxBoxItemLine>(static_cast<int>(nLine)^1)); + const ::editeng::SvxBorderLine* pBorderLine2 = xBorderInfo->maBorder->GetLine(static_cast<SvxBoxItemLine>(static_cast<int>(nLine)^1)); if( pBorderLine2 && pBorderLine2->HasPriority(*pBorderLine) ) continue; // other border line wins } diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 74af18c0e071..c8e3bfd77124 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -224,9 +224,9 @@ namespace try // fdo#48775 { - SfxStringItem aURL(SID_FILE_NAME, OUString(".component:Bibliography/View1")); - SfxStringItem aRef(SID_REFERER, OUString("private:user")); - SfxStringItem aTarget(SID_TARGETNAME, OUString("_blank")); + SfxStringItem aURL(SID_FILE_NAME, ".component:Bibliography/View1"); + SfxStringItem aRef(SID_REFERER, "private:user"); + SfxStringItem aTarget(SID_TARGETNAME, "_blank"); SfxViewFrame::Current()->GetDispatcher()->ExecuteList(SID_OPENDOC, SfxCallMode::ASYNCHRON, { &aURL, &aRef, &aTarget }); } @@ -402,7 +402,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) return; } - SfxStringItem aNameItem( SID_FILE_NAME, OUString("vnd.sun.star.cmd:logout") ); + SfxStringItem aNameItem( SID_FILE_NAME, "vnd.sun.star.cmd:logout" ); SfxStringItem aReferer( SID_REFERER, "private/user" ); pImpl->pAppDispat->ExecuteList(SID_OPENDOC, SfxCallMode::SLOT, { &aNameItem, &aReferer }); diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx index 965417572ba5..9a2c3fb657f9 100644 --- a/sfx2/source/appl/linkmgr2.cxx +++ b/sfx2/source/appl/linkmgr2.cxx @@ -661,7 +661,7 @@ bool SvxInternalLink::Connect( sfx2::SvBaseLink* pLink ) SfxStringItem aName( SID_FILE_NAME, sTopic ); SfxBoolItem aMinimized(SID_MINIMIZED, true); SfxBoolItem aHidden(SID_HIDDEN, true); - SfxStringItem aTarget( SID_TARGETNAME, OUString("_blank") ); + SfxStringItem aTarget( SID_TARGETNAME, "_blank" ); SfxStringItem aReferer( SID_REFERER, sReferer ); SfxUInt16Item aUpdate( SID_UPDATEDOCMODE, nUpdateMode ); SfxBoolItem aReadOnly(SID_DOC_READONLY, false); diff --git a/sfx2/source/config/evntconf.cxx b/sfx2/source/config/evntconf.cxx index fbcbe656dec1..1365ead79d69 100644 --- a/sfx2/source/config/evntconf.cxx +++ b/sfx2/source/config/evntconf.cxx @@ -95,12 +95,6 @@ SfxPoolItem* SfxEventNamesItem::Clone( SfxItemPool *) const return new SfxEventNamesItem(*this); } -sal_uInt16 SfxEventNamesItem::GetVersion( sal_uInt16 ) const -{ - OSL_FAIL("not streamable!"); - return 0; -} - void SfxEventNamesItem::AddEvent( const OUString& rName, const OUString& rUIName, SvMacroItemId nID ) { aEventsList.push_back( SfxEventName( nID, rName, !rUIName.isEmpty() ? rUIName : rName ) ); diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index 8c918cae923f..65d0e1e54d62 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -103,12 +103,6 @@ SfxPoolItem* SfxTabDialogItem::Clone(SfxItemPool* pToPool) const return new SfxTabDialogItem( *this, pToPool ); } -SfxPoolItem* SfxTabDialogItem::Create(SvStream& /*rStream*/, sal_uInt16 /*nVersion*/) const -{ - OSL_FAIL( "Use it only in UI!" ); - return nullptr; -} - typedef std::vector<Data_Impl*> SfxTabDlgData_Impl; struct TabDlg_Impl diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist index f7bafad27c4f..50f21b920c39 100644 --- a/solenv/clang-format/blacklist +++ b/solenv/clang-format/blacklist @@ -4067,6 +4067,7 @@ editeng/source/items/frmitems.cxx editeng/source/items/itemtype.cxx editeng/source/items/justifyitem.cxx editeng/source/items/numitem.cxx +editeng/source/items/legacyitem.cxx editeng/source/items/optitems.cxx editeng/source/items/paperinf.cxx editeng/source/items/paraitem.cxx @@ -6261,6 +6262,7 @@ include/editeng/justifyitem.hxx include/editeng/keepitem.hxx include/editeng/kernitem.hxx include/editeng/langitem.hxx +include/editeng/legacyitem.hxx include/editeng/lineitem.hxx include/editeng/lrspitem.hxx include/editeng/lspcitem.hxx @@ -6877,6 +6879,7 @@ include/svl/itemprop.hxx include/svl/itemset.hxx include/svl/languageoptions.hxx include/svl/lckbitem.hxx +include/svl/legacyitem.hxx include/svl/listener.hxx include/svl/lngmisc.hxx include/svl/lockfilecommon.hxx @@ -7038,6 +7041,7 @@ include/svx/AccessibleShapeTreeInfo.hxx include/svx/AccessibleTextHelper.hxx include/svx/ActionDescriptionProvider.hxx include/svx/AffineMatrixItem.hxx +include/svx/autoformathelper.hxx include/svx/ChildrenManager.hxx include/svx/ClassificationDialog.hxx include/svx/ClassificationEditView.hxx @@ -7168,6 +7172,7 @@ include/svx/langbox.hxx include/svx/lathe3d.hxx include/svx/layctrl.hxx include/svx/lboxctrl.hxx +include/svx/legacyitem.hxx include/svx/linectrl.hxx include/svx/linkwarn.hxx include/svx/measctrl.hxx @@ -13621,6 +13626,7 @@ svl/source/items/itemiter.cxx svl/source/items/itempool.cxx svl/source/items/itemprop.cxx svl/source/items/itemset.cxx +svl/source/items/legacyitem.cxx svl/source/items/lckbitem.cxx svl/source/items/macitem.cxx svl/source/items/poolcach.cxx @@ -14234,6 +14240,7 @@ svx/source/inc/xmlxtexp.hxx svx/source/inc/xmlxtimp.hxx svx/source/items/SmartTagItem.cxx svx/source/items/algitem.cxx +svx/source/items/autoformathelper.cxx svx/source/items/chrtitem.cxx svx/source/items/clipfmtitem.cxx svx/source/items/customshapeitem.cxx @@ -14242,6 +14249,7 @@ svx/source/items/e3ditem.cxx svx/source/items/galleryitem.cxx svx/source/items/grfitem.cxx svx/source/items/hlnkitem.cxx +svx/source/items/legacyitem.cxx svx/source/items/numfmtsh.cxx svx/source/items/numinf.cxx svx/source/items/ofaitem.cxx @@ -14656,6 +14664,7 @@ sw/inc/IDocumentUndoRedo.hxx sw/inc/IGrammarContact.hxx sw/inc/IMark.hxx sw/inc/IShellCursorSupplier.hxx +sw/inc/legacyitem.hxx sw/inc/PageColumnPopup.hxx sw/inc/PageMarginPopup.hxx sw/inc/PageOrientationPopup.hxx @@ -15352,6 +15361,7 @@ sw/source/core/layout/layact.cxx sw/source/core/layout/laycache.cxx sw/source/core/layout/layhelp.hxx sw/source/core/layout/layouter.cxx +sw/source/core/layout/legacyitem.cxx sw/source/core/layout/movedfwdfrmsbyobjpos.cxx sw/source/core/layout/newfrm.cxx sw/source/core/layout/objectformatter.cxx diff --git a/svl/Library_svl.mk b/svl/Library_svl.mk index 4dad7be2a929..28a043bdb310 100644 --- a/svl/Library_svl.mk +++ b/svl/Library_svl.mk @@ -144,6 +144,7 @@ $(eval $(call gb_Library_add_exception_objects,svl,\ svl/source/items/IndexedStyleSheets \ svl/source/items/itemset \ svl/source/items/lckbitem \ + svl/source/items/legacyitem \ svl/source/items/macitem \ svl/source/items/poolcach \ svl/source/items/poolio \ diff --git a/svl/source/items/aeitem.cxx b/svl/source/items/aeitem.cxx index afebf9d72a9b..37962147e70c 100644 --- a/svl/source/items/aeitem.cxx +++ b/svl/source/items/aeitem.cxx @@ -39,12 +39,6 @@ SfxAllEnumItem::SfxAllEnumItem(sal_uInt16 which, sal_uInt16 nVal): InsertValue( nVal ); } -SfxAllEnumItem::SfxAllEnumItem( sal_uInt16 which, SvStream &rStream ): - SfxAllEnumItem_Base(which, rStream) -{ - InsertValue( GetValue() ); -} - SfxAllEnumItem::SfxAllEnumItem(sal_uInt16 which): SfxAllEnumItem_Base(which, 0) { @@ -83,11 +77,6 @@ SfxPoolItem* SfxAllEnumItem::Clone( SfxItemPool * ) const return new SfxAllEnumItem(*this); } -SfxPoolItem* SfxAllEnumItem::Create( SvStream & rStream, sal_uInt16 ) const -{ - return new SfxAllEnumItem( Which(), rStream ); -} - /** * In contrast to @see GetPosByValue(sal_uInt16) const * this internal method returns the position the value would be for non-present values. diff --git a/svl/source/items/cenumitm.cxx b/svl/source/items/cenumitm.cxx index d69e072afb93..3889d72a924c 100644 --- a/svl/source/items/cenumitm.cxx +++ b/svl/source/items/cenumitm.cxx @@ -143,19 +143,6 @@ bool SfxBoolItem::PutValue(const css::uno::Any& rVal, sal_uInt8) } // virtual -SfxPoolItem * SfxBoolItem::Create(SvStream & rStream, sal_uInt16) const -{ - return new SfxBoolItem(Which(), rStream); -} - -// virtual -SvStream & SfxBoolItem::Store(SvStream & rStream, sal_uInt16) const -{ - rStream.WriteBool( m_bValue ); // not bool for serialization! - return rStream; -} - -// virtual SfxPoolItem * SfxBoolItem::Clone(SfxItemPool *) const { return new SfxBoolItem(*this); diff --git a/svl/source/items/cintitem.cxx b/svl/source/items/cintitem.cxx index 4fc6c754c8ef..4545a8ae2cc5 100644 --- a/svl/source/items/cintitem.cxx +++ b/svl/source/items/cintitem.cxx @@ -62,35 +62,12 @@ bool CntByteItem::PutValue(const css::uno::Any& rVal, sal_uInt8) } // virtual -SfxPoolItem * CntByteItem::Create(SvStream & rStream, sal_uInt16) const -{ - short nTheValue = 0; - rStream.ReadInt16( nTheValue ); - return new CntByteItem(Which(), sal_uInt8(nTheValue)); -} - -// virtual -SvStream & CntByteItem::Store(SvStream & rStream, sal_uInt16) const -{ - rStream.WriteInt16( short(m_nValue) ); - return rStream; -} - -// virtual SfxPoolItem * CntByteItem::Clone(SfxItemPool *) const { return new CntByteItem(*this); } -CntUInt16Item::CntUInt16Item(sal_uInt16 which, SvStream & rStream) : - SfxPoolItem(which) -{ - sal_uInt16 nTheValue = 0; - rStream.ReadUInt16( nTheValue ); - m_nValue = nTheValue; -} - // virtual bool CntUInt16Item::operator ==(const SfxPoolItem & rItem) const { @@ -133,32 +110,12 @@ bool CntUInt16Item::PutValue(const css::uno::Any& rVal, sal_uInt8) } // virtual -SfxPoolItem * CntUInt16Item::Create(SvStream & rStream, sal_uInt16) const -{ - return new CntUInt16Item(Which(), rStream); -} - -// virtual -SvStream & CntUInt16Item::Store(SvStream &rStream, sal_uInt16) const -{ - rStream.WriteUInt16( m_nValue ); - return rStream; -} - -// virtual SfxPoolItem * CntUInt16Item::Clone(SfxItemPool *) const { return new CntUInt16Item(*this); } -CntInt32Item::CntInt32Item(sal_uInt16 which, SvStream & rStream) - : SfxPoolItem(which) - , m_nValue(0) -{ - rStream.ReadInt32( m_nValue ); -} - // virtual bool CntInt32Item::operator ==(const SfxPoolItem & rItem) const { @@ -199,33 +156,12 @@ bool CntInt32Item::PutValue(const css::uno::Any& rVal, sal_uInt8) } // virtual -SfxPoolItem * CntInt32Item::Create(SvStream & rStream, sal_uInt16) const -{ - return new CntInt32Item(Which(), rStream); -} - -// virtual -SvStream & CntInt32Item::Store(SvStream &rStream, sal_uInt16) const -{ - rStream.WriteInt32( m_nValue ); - return rStream; -} - -// virtual SfxPoolItem * CntInt32Item::Clone(SfxItemPool *) const { return new CntInt32Item(*this); } -CntUInt32Item::CntUInt32Item(sal_uInt16 which, SvStream & rStream) : - SfxPoolItem(which) -{ - sal_uInt32 nTheValue = 0; - rStream.ReadUInt32( nTheValue ); - m_nValue = nTheValue; -} - // virtual bool CntUInt32Item::operator ==(const SfxPoolItem & rItem) const { @@ -269,19 +205,6 @@ bool CntUInt32Item::PutValue(const css::uno::Any& rVal, sal_uInt8) } // virtual -SfxPoolItem * CntUInt32Item::Create(SvStream & rStream, sal_uInt16) const -{ - return new CntUInt32Item(Which(), rStream); -} - -// virtual -SvStream & CntUInt32Item::Store(SvStream &rStream, sal_uInt16) const -{ - rStream.WriteUInt32( m_nValue ); - return rStream; -} - -// virtual SfxPoolItem * CntUInt32Item::Clone(SfxItemPool *) const { return new CntUInt32Item(*this); diff --git a/svl/source/items/flagitem.cxx b/svl/source/items/flagitem.cxx index 9bd233c0e91f..96db1c338413 100644 --- a/svl/source/items/flagitem.cxx +++ b/svl/source/items/flagitem.cxx @@ -31,13 +31,6 @@ SfxFlagItem::SfxFlagItem( sal_uInt16 nW, sal_uInt16 nV ) : } -SvStream& SfxFlagItem::Store(SvStream &rStream, sal_uInt16) const -{ - rStream.WriteUInt16( nVal ); - return rStream; -} - - bool SfxFlagItem::GetPresentation ( SfxItemPresentation /*ePresentation*/, @@ -61,13 +54,6 @@ sal_uInt8 SfxFlagItem::GetFlagCount() const } -SfxPoolItem* SfxFlagItem::Create(SvStream &, sal_uInt16) const -{ - SAL_INFO("svl", "calling Create() on SfxFlagItem -- override!"); - return nullptr; -} - - bool SfxFlagItem::operator==( const SfxPoolItem& rItem ) const { assert(SfxPoolItem::operator==(rItem)); diff --git a/svl/source/items/int64item.cxx b/svl/source/items/int64item.cxx index b5dc818b9d46..c32794a359ff 100644 --- a/svl/source/items/int64item.cxx +++ b/svl/source/items/int64item.cxx @@ -15,12 +15,6 @@ SfxInt64Item::SfxInt64Item( sal_uInt16 nWhich, sal_Int64 nVal ) : { } -SfxInt64Item::SfxInt64Item( sal_uInt16 nWhich, SvStream& rStream ) : - SfxPoolItem(nWhich), mnValue(0) -{ - rStream.ReadInt64(mnValue); -} - SfxInt64Item::~SfxInt64Item() {} bool SfxInt64Item::operator== ( const SfxPoolItem& rItem ) const @@ -57,16 +51,6 @@ bool SfxInt64Item::PutValue( return false; } -SfxPoolItem* SfxInt64Item::Create( SvStream& rStream, sal_uInt16 /*nItemVersion*/ ) const -{ - return new SfxInt64Item(Which(), rStream); -} - -SvStream& SfxInt64Item::Store( SvStream& rStream, sal_uInt16 /*nItemVersion*/ ) const -{ - return rStream.WriteInt64(mnValue); -} - SfxPoolItem* SfxInt64Item::Clone( SfxItemPool* /*pOther*/ ) const { return new SfxInt64Item(*this); diff --git a/svl/source/items/intitem.cxx b/svl/source/items/intitem.cxx index 8e8ce37ea335..70be1383349e 100644 --- a/svl/source/items/intitem.cxx +++ b/svl/source/items/intitem.cxx @@ -35,27 +35,11 @@ SfxPoolItem* SfxByteItem::CreateDefault() return new SfxByteItem(); }; -// virtual -SfxPoolItem * SfxByteItem::Create(SvStream & rStream, sal_uInt16) const -{ - short nValue = 0; - rStream.ReadInt16( nValue ); - return new SfxByteItem(Which(), sal_uInt8(nValue)); -} - SfxPoolItem* SfxInt16Item::CreateDefault() { return new SfxInt16Item(); }; -SfxInt16Item::SfxInt16Item(sal_uInt16 which, SvStream & rStream): - SfxPoolItem(which) -{ - short nTheValue = 0; - rStream.ReadInt16( nTheValue ); - m_nValue = nTheValue; -} - // virtual bool SfxInt16Item::operator ==(const SfxPoolItem & rItem) const { @@ -97,19 +81,6 @@ bool SfxInt16Item::PutValue(const css::uno::Any& rVal, sal_uInt8 ) return false; } -// virtual -SfxPoolItem * SfxInt16Item::Create(SvStream & rStream, sal_uInt16) const -{ - return new SfxInt16Item(Which(), rStream); -} - -// virtual -SvStream & SfxInt16Item::Store(SvStream & rStream, sal_uInt16) const -{ - rStream.WriteInt16( short(m_nValue) ); - return rStream; -} - SfxPoolItem * SfxInt16Item::Clone(SfxItemPool *) const { return new SfxInt16Item(*this); diff --git a/svl/source/items/lckbitem.cxx b/svl/source/items/lckbitem.cxx index 5c2efba1e9b1..a610380243cc 100644 --- a/svl/source/items/lckbitem.cxx +++ b/svl/source/items/lckbitem.cxx @@ -34,17 +34,6 @@ SfxLockBytesItem::SfxLockBytesItem() } -SfxLockBytesItem::SfxLockBytesItem( sal_uInt16 nW, SvStream &rStream ) -: SfxPoolItem( nW ) -{ - rStream.Seek( 0 ); - _xVal = new SvLockBytes( new SvMemoryStream(), true ); - - SvStream aLockBytesStream( _xVal.get() ); - rStream.ReadStream( aLockBytesStream ); -} - - SfxLockBytesItem::~SfxLockBytesItem() { } @@ -62,42 +51,6 @@ SfxPoolItem* SfxLockBytesItem::Clone(SfxItemPool *) const } -#define MAX_BUF 32000 - -SfxPoolItem* SfxLockBytesItem::Create( SvStream &rStream, sal_uInt16 ) const -{ - sal_uInt32 nSize = 0; - sal_uLong nActRead = 0; - sal_Char cTmpBuf[MAX_BUF]; - SvMemoryStream aNewStream; - rStream.ReadUInt32( nSize ); - - do { - sal_uLong nToRead; - if( (nSize - nActRead) > MAX_BUF ) - nToRead = MAX_BUF; - else - nToRead = nSize - nActRead; - nActRead += rStream.ReadBytes( cTmpBuf, nToRead ); - aNewStream.WriteBytes( cTmpBuf, nToRead ); - } while( nSize > nActRead ); - - return new SfxLockBytesItem( Which(), aNewStream ); -} - - -SvStream& SfxLockBytesItem::Store(SvStream &rStream, sal_uInt16 ) const -{ - SvStream aLockBytesStream( _xVal.get() ); - sal_uInt32 nSize = aLockBytesStream.Seek( STREAM_SEEK_TO_END ); - aLockBytesStream.Seek( 0 ); - - rStream.WriteUInt32( nSize ); - rStream.WriteStream( aLockBytesStream ); - - return rStream; -} - // virtual bool SfxLockBytesItem::PutValue( const css::uno::Any& rVal, sal_uInt8 ) { diff --git a/svl/source/items/legacyitem.cxx b/svl/source/items/legacyitem.cxx new file mode 100755 index 000000000000..b0daa3b9066e --- /dev/null +++ b/svl/source/items/legacyitem.cxx @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <svl/legacyitem.hxx> +#include <tools/stream.hxx> +#include <svl/eitem.hxx> +#include <svl/cintitem.hxx> + +namespace legacy +{ + namespace SfxBool + { + sal_uInt16 GetVersion(sal_uInt16) + { + return 0; + } + + void Create(SfxBoolItem& rItem, SvStream& rStrm, sal_uInt16) + { + bool tmp(false); + rStrm.ReadCharAsBool(tmp); + rItem.SetValue(tmp); + } + + SvStream& Store(const SfxBoolItem& rItem, SvStream& rStrm, sal_uInt16) + { + rStrm.WriteBool(rItem.GetValue()); // not bool for serialization! + return rStrm; + } + } + namespace CntInt32 + { + sal_uInt16 GetVersion(sal_uInt16) + { + return 0; + } + + void Create(CntInt32Item& rItem, SvStream& rStrm, sal_uInt16) + { + sal_Int32 tmp(0); + rStrm.ReadInt32(tmp); + rItem.SetValue(tmp); + } + + SvStream& Store(const CntInt32Item& rItem, SvStream& rStrm, sal_uInt16) + { + rStrm.WriteInt32(rItem.GetValue()); + return rStrm; + } + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svl/source/items/macitem.cxx b/svl/source/items/macitem.cxx index f45b7bfe9bf2..3c7fac91143a 100644 --- a/svl/source/items/macitem.cxx +++ b/svl/source/items/macitem.cxx @@ -248,11 +248,4 @@ void SvxMacroItem::SetMacro( SvMacroItemId nEvent, const SvxMacro& rMacro ) aMacroTable.Insert( nEvent, rMacro); } - -sal_uInt16 SvxMacroItem::GetVersion( sal_uInt16 nFileFormatVersion ) const -{ - return SOFFICE_FILEFORMAT_31 == nFileFormatVersion - ? 0 : SvxMacroTableDtor::GetVersion(); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx index 346e38324bce..a5501dc907d8 100644 --- a/svl/source/items/poolitem.cxx +++ b/svl/source/items/poolitem.cxx @@ -26,6 +26,450 @@ #include <libxml/xmlwriter.h> #include <typeinfo> +////////////////////////////////////////////////////////////////////////////// +// list of classes derived from SfxPoolItem +// will not be kept up-to-date, but give a good overview for right now +////////////////////////////////////////////////////////////////////////////// +// +// class SbxItem : public SfxPoolItem +// class SvxChartColorTableItem : public SfxPoolItem +// class DriverPoolingSettingsItem final : public SfxPoolItem +// class DatabaseMapItem final : public SfxPoolItem +// class DbuTypeCollectionItem : public SfxPoolItem +// class OptionalBoolItem : public SfxPoolItem +// class OStringListItem : public SfxPoolItem +// class MediaItem : public SfxPoolItem +// class SvxBoxItem : public SfxPoolItem +// class SvxBoxInfoItem : public SfxPoolItem +// class SvxBrushItem : public SfxPoolItem +// class SvxBulletItem : public SfxPoolItem +// class SvxColorItem : public SfxPoolItem +// class SvxBackgroundColorItem : public SvxColorItem +// class SvxFontHeightItem : public SfxPoolItem +// class SvxFieldItem : public SfxPoolItem +// class SvxFontListItem : public SfxPoolItem +// class SvxFontItem : public SfxPoolItem +// class SvxHyphenZoneItem : public SfxPoolItem +// class SvxLineItem : public SfxPoolItem +// class SvxLRSpaceItem : public SfxPoolItem +// class SvxNumBulletItem : public SfxPoolItem +// class SfxHyphenRegionItem: public SfxPoolItem +// class SvxProtectItem : public SfxPoolItem +// class SvxSizeItem : public SfxPoolItem +// class SwFormatFrameSize: public SvxSizeItem +// class SvxTabStopItem : public SfxPoolItem +// class SvxTwoLinesItem : public SfxPoolItem +// class SvxULSpaceItem : public SfxPoolItem +// class SvXMLAttrContainerItem: public SfxPoolItem +// class SfxLinkItem : public SfxPoolItem +// class SfxEventNamesItem : public SfxPoolItem +// class SfxFrameItem: public SfxPoolItem +// class SfxUnoAnyItem : public SfxPoolItem +// class SfxUnoFrameItem : public SfxPoolItem +// class SfxMacroInfoItem: public SfxPoolItem +// class SfxObjectItem: public SfxPoolItem +// class SfxObjectShellItem: public SfxPoolItem +// class SfxViewFrameItem: public SfxPoolItem +// class SfxWatermarkItem: public SfxPoolItem +// class SfxEnumItemInterface: public SfxPoolItem +// class SvxAdjustItem : public SfxEnumItemInterface +// class SvxEscapementItem : public SfxEnumItemInterface +// class SvxLineSpacingItem : public SfxEnumItemInterface +// class SvxShadowItem : public SfxEnumItemInterface +// class SfxEnumItem : public SfxEnumItemInterface +// class SvxCharReliefItem : public SfxEnumItem<FontRelief> +// class SvxCaseMapItem : public SfxEnumItem<SvxCaseMap> +// class SvxCrossedOutItem : public SfxEnumItem<FontStrikeout> +// class SvxFormatBreakItem : public SfxEnumItem<SvxBreak> +// class SvxFrameDirectionItem : public SfxEnumItem<SvxFrameDirection> +// class SvxHorJustifyItem: public SfxEnumItem<SvxCellHorJustify> +// class SvxVerJustifyItem: public SfxEnumItem<SvxCellVerJustify> +// class SvxJustifyMethodItem: public SfxEnumItem<SvxCellJustifyMethod> +// class SvxLanguageItem_Base: public SfxEnumItem<LanguageType> +// class SvxLanguageItem : public SvxLanguageItem_Base +// class SvxPostureItem : public SfxEnumItem<FontItalic> +// class SvxTextLineItem : public SfxEnumItem<FontLineStyle> +// class SvxUnderlineItem : public SvxTextLineItem +// class SvxOverlineItem : public SvxTextLineItem +// class SvxWeightItem : public SfxEnumItem<FontWeight> +// class SfxAllEnumItem_Base: public SfxEnumItem<sal_uInt16> +// class SfxAllEnumItem: public SfxAllEnumItem_Base +// class SvxOrientationItem: public SfxEnumItem<SvxCellOrientation> +// class SvxChartRegressItem : public SfxEnumItem<SvxChartRegress> +// class SvxChartTextOrderItem : public SfxEnumItem<SvxChartTextOrder> +// class SvxChartKindErrorItem : public SfxEnumItem<SvxChartKindError> +// class SvxChartIndicateItem : public SfxEnumItem<SvxChartIndicate> +// class SvxRotateModeItem: public SfxEnumItem<SvxRotateMode> +// class SdrGrafModeItem_Base: public SfxEnumItem<GraphicDrawMode> +// class SdrGrafModeItem : public SdrGrafModeItem_Base +// class SdrTextAniDirectionItem: public SfxEnumItem<SdrTextAniDirection> +// class SdrTextVertAdjustItem: public SfxEnumItem<SdrTextVertAdjust> +// class SdrTextHorzAdjustItem: public SfxEnumItem<SdrTextHorzAdjust> +// class SdrTextAniKindItem: public SfxEnumItem<SdrTextAniKind> +// class SdrTextFitToSizeTypeItem : public SfxEnumItem<css::drawing::TextFitToSizeType> +// class SdrCaptionEscDirItem: public SfxEnumItem<SdrCaptionEscDir> +// class SdrCaptionTypeItem: public SfxEnumItem<SdrCaptionType> +// class SdrEdgeKindItem: public SfxEnumItem<SdrEdgeKind> +// class SdrMeasureTextHPosItem: public SfxEnumItem<css::drawing::MeasureTextHorzPos> +// class SdrMeasureTextVPosItem: public SfxEnumItem<css::drawing::MeasureTextVertPos> +// class SdrMeasureUnitItem: public SfxEnumItem<FieldUnit> +// class XFillStyleItem : public SfxEnumItem<css::drawing::FillStyle> +// class XFillBmpPosItem : public SfxEnumItem<RectPoint> +// class XFormTextAdjustItem : public SfxEnumItem<XFormTextAdjust> +// class XFormTextShadowItem : public SfxEnumItem<XFormTextShadow> +// class XLineStyleItem : public SfxEnumItem<css::drawing::LineStyle> +// class XLineJointItem : public SfxEnumItem<css::drawing::LineJoint> +// class XLineCapItem : public SfxEnumItem<css::drawing::LineCap> +// class XFormTextStyleItem : public SfxEnumItem<XFormTextStyle> +// class ScViewObjectModeItem: public SfxEnumItem<ScVObjMode> +// class SdrCircKindItem: public SfxEnumItem<SdrCircKind> +// class SdrMeasureKindItem: public SfxEnumItem<SdrMeasureKind> +// class SwFormatFillOrder: public SfxEnumItem<SwFillOrder> +// class SwFormatFootnoteEndAtTextEnd : public SfxEnumItem<SwFootnoteEndPosEnum> +// class SwFormatFootnoteAtTextEnd : public SwFormatFootnoteEndAtTextEnd +// class SwFormatEndAtTextEnd : public SwFormatFootnoteEndAtTextEnd +// class SwFormatSurround: public SfxEnumItem<css::text::WrapTextMode> +// class SwMirrorGrf : public SfxEnumItem<MirrorGraph> +// class SwDrawModeGrf_Base: public SfxEnumItem<GraphicDrawMode> +// class SwDrawModeGrf : public SwDrawModeGrf_Base +//class CntByteItem: public SfxPoolItem +// class SfxByteItem: public CntByteItem +// class SvxOrphansItem: public SfxByteItem +// class SvxPaperBinItem : public SfxByteItem +// class SvxWidowsItem: public SfxByteItem +// class SwTransparencyGrf : public SfxByteItem +//class CntUInt16Item: public SfxPoolItem +// class SfxUInt16Item: public CntUInt16Item +// class SvxTextRotateItem : public SfxUInt16Item +// class SvxCharRotateItem : public SvxTextRotateItem +// class SvxCharScaleWidthItem : public SfxUInt16Item +// class SvxEmphasisMarkItem : public SfxUInt16Item +// class SvxParaVertAlignItem : public SfxUInt16Item +// class SvxWritingModeItem : public SfxUInt16Item +// class SvxZoomItem: public SfxUInt16Item +// class SdrPercentItem : public SfxUInt16Item +// class SdrGrafTransparenceItem : public SdrPercentItem +// class SdrTextAniCountItem: public SfxUInt16Item +// class SdrTextAniDelayItem: public SfxUInt16Item +// class Svx3DNormalsKindItem : public SfxUInt16Item +// class Svx3DTextureProjectionXItem : public SfxUInt16Item +// class Svx3DTextureProjectionYItem : public SfxUInt16Item +// class Svx3DTextureKindItem : public SfxUInt16Item +// class Svx3DTextureModeItem : public SfxUInt16Item +// class Svx3DPerspectiveItem : public SfxUInt16Item +// class Svx3DShadeModeItem : public SfxUInt16Item +// class SdrEdgeLineDeltaCountItem: public SfxUInt16Item +// class SvxViewLayoutItem: public SfxUInt16Item +// class XFillBmpPosOffsetXItem : public SfxUInt16Item +// class XFillBmpPosOffsetYItem : public SfxUInt16Item +// class XFillBmpTileOffsetXItem : public SfxUInt16Item +// class XFillBmpTileOffsetYItem : public SfxUInt16Item +// class XFillTransparenceItem: public SfxUInt16Item +// class XFormTextShadowTranspItem: public SfxUInt16Item +// class XGradientStepCountItem: public SfxUInt16Item +// class XLineTransparenceItem: public SfxUInt16Item +// class SvxZoomSliderItem: public SfxUInt16Item +// class SdrLayerIdItem: public SfxUInt16Item +// class SwRotationGrf : public SfxUInt16Item +//class CntInt32Item: public SfxPoolItem +// class SfxInt32Item: public CntInt32Item +// class SfxMetricItem: public SfxInt32Item +// class XFillBmpSizeXItem : public SfxMetricItem +// class XFillBmpSizeYItem : public SfxMetricItem +// class XFormTextDistanceItem : public SfxMetricItem +// class XFormTextShadowXValItem : public SfxMetricItem +// class XFormTextShadowYValItem : public SfxMetricItem +// class XFormTextStartItem : public SfxMetricItem +// class XLineEndWidthItem : public SfxMetricItem +// class XLineStartWidthItem : public SfxMetricItem +// class XLineWidthItem : public SfxMetricItem +// class SdrAngleItem: public SfxInt32Item +// +// class SdrCaptionAngleItem: public SdrAngleItem +// class SdrMeasureTextFixedAngleItem: public SdrAngleItem +// class SdrMeasureTextAutoAngleViewItem: public SdrAngleItem +// class SdrRotateAllItem: public SdrAngleItem +// class SdrRotateOneItem: public SdrAngleItem +// class SdrShearAngleItem: public SdrAngleItem +// class SdrHorzShearAllItem: public SdrAngleItem +// class SdrVertShearAllItem: public SdrAngleItem +// class SdrHorzShearOneItem: public SdrAngleItem +// class SdrVertShearOneItem: public SdrAngleItem +// class SdrMetricItem: public SfxInt32Item +// class SdrCaptionEscAbsItem: public SdrMetricItem +// class SdrCaptionGapItem: public SdrMetricItem +// class SdrCaptionLineLenItem: public SdrMetricItem +// class SdrEdgeNode1HorzDistItem: public SdrMetricItem +// class SdrEdgeNode1VertDistItem: public SdrMetricItem +// class SdrEdgeNode2HorzDistItem: public SdrMetricItem +// class SdrEdgeNode2VertDistItem: public SdrMetricItem +// class SdrEdgeNode1GlueDistItem: public SdrMetricItem +// class SdrEdgeNode2GlueDistItem: public SdrMetricItem +// class SdrAllPositionXItem: public SdrMetricItem +// class SdrAllPositionYItem: public SdrMetricItem +// class SdrAllSizeWidthItem: public SdrMetricItem +// class SdrAllSizeHeightItem: public SdrMetricItem +// class SdrLogicSizeWidthItem: public SdrMetricItem +// class SdrLogicSizeHeightItem: public SdrMetricItem +// class SdrMeasureOverhangItem: public SdrMetricItem +// class SdrMoveXItem: public SdrMetricItem +// class SdrMoveYItem: public SdrMetricItem +// class SdrOnePositionXItem: public SdrMetricItem +// class SdrOnePositionYItem: public SdrMetricItem +// class SdrOneSizeWidthItem: public SdrMetricItem +// class SdrOneSizeHeightItem: public SdrMetricItem +// class SdrTransformRef1XItem: public SdrMetricItem +// class SdrTransformRef1YItem: public SdrMetricItem +// class SdrTransformRef2XItem: public SdrMetricItem +// class SdrTransformRef2YItem: public SdrMetricItem +// class SdrCaptionEscRelItem: public SfxInt32Item +//class CntUInt32Item: public SfxPoolItem +// class SfxUInt32Item: public CntUInt32Item +// class SvxRsidItem : public SfxUInt32Item +// class SdrGrafGamma100Item : public SfxUInt32Item +// class SwTableBoxNumFormat : public SfxUInt32Item +//class CntUnencodedStringItem: public SfxPoolItem +// class SfxStringItem: public CntUnencodedStringItem +// class SvxPageModelItem : public SfxStringItem +// class SfxDocumentInfoItem : public SfxStringItem +// class SvxPostItAuthorItem: public SfxStringItem +// class SvxPostItDateItem: public SfxStringItem +// class SvxPostItTextItem: public SfxStringItem +// class SvxPostItIdItem: public SfxStringItem +// class SdrMeasureFormatStringItem: public SfxStringItem +// class NameOrIndex : public SfxStringItem +// class XFillBitmapItem : public NameOrIndex +// class XColorItem : public NameOrIndex +// class XFillColorItem : public XColorItem +// class XFormTextShadowColorItem : public XColorItem +// class XLineColorItem : public XColorItem +// class XSecondaryFillColorItem : public XColorItem +// class XFillGradientItem : public NameOrIndex +// class XFillFloatTransparenceItem : public XFillGradientItem +// class XFillHatchItem : public NameOrIndex +// class XLineDashItem : public NameOrIndex +// class XLineEndItem : public NameOrIndex +// class XLineStartItem : public NameOrIndex +// class SfxScriptOrganizerItem : public SfxStringItem +// class SdrLayerNameItem: public SfxStringItem +// class SwNumRuleItem : public SfxStringItem +//class SfxBoolItem : public SfxPoolItem +// class SvxAutoKernItem : public SfxBoolItem +// class SvxBlinkItem : public SfxBoolItem +// class SvxCharHiddenItem : public SfxBoolItem +// class SvxContourItem : public SfxBoolItem +// class SvxForbiddenRuleItem : public SfxBoolItem +// class SvxHangingPunctuationItem : public SfxBoolItem +// class SvxFormatKeepItem : public SfxBoolItem +// class SvxNoHyphenItem : public SfxBoolItem +// class SvxOpaqueItem : public SfxBoolItem +// class SvxParaGridItem : public SfxBoolItem +// class SvxPrintItem : public SfxBoolItem +// class SvxScriptSpaceItem : public SfxBoolItem +// class SvxShadowedItem : public SfxBoolItem +// class SvxFormatSplitItem : public SfxBoolItem +// class SvxWordLineModeItem : public SfxBoolItem +// class SdrOnOffItem: public SfxBoolItem +// class SdrGrafInvertItem : public SdrOnOffItem +// class SdrTextFixedCellHeightItem : public SfxBoolItem +// class SdrYesNoItem: public SfxBoolItem +// class SdrTextAniStartInsideItem: public SdrYesNoItem +// class SdrTextAniStopInsideItem: public SdrYesNoItem +// class SdrCaptionEscIsRelItem: public SdrYesNoItem +// class SdrCaptionFitLineLenItem: public SdrYesNoItem +// class SdrMeasureBelowRefEdgeItem: public SdrYesNoItem +// class SdrMeasureTextIsFixedAngleItem: public SdrYesNoItem +// class SdrMeasureTextRota90Item: public SdrYesNoItem +// class SdrMeasureTextUpsideDownItem: public SdrYesNoItem +// class SdrMeasureTextAutoAngleItem: public SdrYesNoItem +// class SdrObjPrintableItem: public SdrYesNoItem +// class SdrObjVisibleItem: public SdrYesNoItem +// class Svx3DReducedLineGeometryItem : public SfxBoolItem +// class Svx3DSmoothNormalsItem : public SfxBoolItem +// class Svx3DSmoothLidsItem : public SfxBoolItem +// class Svx3DCharacterModeItem : public SfxBoolItem +// class Svx3DCloseFrontItem : public SfxBoolItem +// class Svx3DCloseBackItem : public SfxBoolItem +// class XFillBackgroundItem : public SfxBoolItem +// class XFillBmpSizeLogItem : public SfxBoolItem +// class XFillBmpTileItem : public SfxBoolItem +// class XFillBmpStretchItem : public SfxBoolItem +// class XFormTextMirrorItem : public SfxBoolItem +// class XFormTextOutlineItem : public SfxBoolItem +// class XLineEndCenterItem : public SfxBoolItem +// class XLineStartCenterItem : public SfxBoolItem +// class XFormTextHideFormItem : public SfxBoolItem +// class SwFormatNoBalancedColumns : public SfxBoolItem +// class SwFormatEditInReadonly : public SfxBoolItem +// class SwFormatFollowTextFlow : public SfxBoolItem +// class SwFormatLayoutSplit : public SfxBoolItem +// class SwFormatRowSplit : public SfxBoolItem +// class SwInvertGrf: public SfxBoolItem +// class SwHeaderAndFooterEatSpacingItem : public SfxBoolItem +// class SwRegisterItem : public SfxBoolItem +// class SwParaConnectBorderItem : public SfxBoolItem +// class SfxFlagItem: public SfxPoolItem +// class SfxTemplateItem: public SfxFlagItem +// class SfxGlobalNameItem: public SfxPoolItem +// class SfxGrabBagItem : public SfxPoolItem +// class SfxIntegerListItem : public SfxPoolItem +// class SfxInt64Item : public SfxPoolItem +// class SfxInt16Item: public SfxPoolItem +// class SvxKerningItem : public SfxInt16Item +// class SfxImageItem : public SfxInt16Item +// class SdrSignedPercentItem : public SfxInt16Item +// class SdrGrafRedItem : public SdrSignedPercentItem +// class SdrGrafGreenItem : public SdrSignedPercentItem +// class SdrGrafBlueItem : public SdrSignedPercentItem +// class SdrGrafLuminanceItem : public SdrSignedPercentItem +// class SdrGrafContrastItem : public SdrSignedPercentItem +// class SdrTextAniAmountItem: public SfxInt16Item +// class SdrMeasureDecimalPlacesItem: public SfxInt16Item +// class ScMergeFlagAttr: public SfxInt16Item +// class SwLuminanceGrf : public SfxInt16Item +// class SwContrastGrf : public SfxInt16Item +// class SwChannelGrf : public SfxInt16Item +// class SfxLockBytesItem : public SfxPoolItem +// class SvxMacroItem: public SfxPoolItem +// class SfxVoidItem final: public SfxPoolItem +// class SfxSetItem: public SfxPoolItem +// class SvxScriptSetItem : public SfxSetItem +// class SfxTabDialogItem: public SfxSetItem +// class SvxSetItem: public SfxSetItem +// class XFillAttrSetItem : public SfxSetItem +// class XLineAttrSetItem : public SfxSetItem +// class ScPatternAttr: public SfxSetItem +// class SfxPointItem: public SfxPoolItem +// class SfxRectangleItem: public SfxPoolItem +// class SfxRangeItem : public SfxPoolItem +// class SfxStringListItem : public SfxPoolItem +// class SvxSearchItem : public SfxPoolItem +// class SfxVisibilityItem: public SfxPoolItem +// class AffineMatrixItem : public SfxPoolItem +// class SvxMarginItem: public SfxPoolItem +// class SvxDoubleItem : public SfxPoolItem +// class SvxClipboardFormatItem : public SfxPoolItem +// class SvxColorListItem: public SfxPoolItem +// class SvxGradientListItem : public SfxPoolItem +// class SvxHatchListItem : public SfxPoolItem +// class SvxBitmapListItem : public SfxPoolItem +// class SvxPatternListItem : public SfxPoolItem +// class SvxDashListItem : public SfxPoolItem +// class SvxLineEndListItem : public SfxPoolItem +// class SvxB3DVectorItem : public SfxPoolItem +// class SvxGalleryItem : public SfxPoolItem +// class SvxGrfCrop : public SfxPoolItem +// class SdrGrafCropItem : public SvxGrfCrop +// class SwCropGrf : public SvxGrfCrop +// class SvxHyperlinkItem : public SfxPoolItem +// class SvxNumberInfoItem : public SfxPoolItem +// class OfaPtrItem : public SfxPoolItem +// class OfaRefItem : public SfxPoolItem +// class SvxGridItem : public SvxOptionsGrid, public SfxPoolItem +// class SdOptionsGridItem : public SvxGridItem +// class SvxPageItem: public SfxPoolItem +// class SvxLongLRSpaceItem : public SfxPoolItem +// class SvxLongULSpaceItem : public SfxPoolItem +// class SvxPagePosSizeItem : public SfxPoolItem +// class SvxColumnItem : public SfxPoolItem +// class SvxObjectItem : public SfxPoolItem +// class SdrCustomShapeGeometryItem : public SfxPoolItem +// class SvxSmartTagItem : public SfxPoolItem +// class SvxGraphicItem: public SfxPoolItem +// class SdrFractionItem: public SfxPoolItem +// class SdrScaleItem: public SdrFractionItem +// class SdrMeasureScaleItem: public SdrScaleItem +// class SdrResizeXAllItem: public SdrFractionItem +// class SdrResizeYAllItem: public SdrFractionItem +// class SdrResizeXOneItem: public SdrFractionItem +// class SdrResizeYOneItem: public SdrFractionItem +// class ScMergeAttr: public SfxPoolItem +// class ScProtectionAttr: public SfxPoolItem +// class ScPageHFItem : public SfxPoolItem +// class ScPageScaleToItem : public SfxPoolItem +// class ScCondFormatItem : public SfxPoolItem +// class ScTpDefaultsItem : public SfxPoolItem +// class ScTpCalcItem : public SfxPoolItem +// class ScTpFormulaItem : public SfxPoolItem +// class ScTpPrintItem : public SfxPoolItem +// class ScTpViewItem : public SfxPoolItem +// class ScCondFormatDlgItem : public SfxPoolItem +// class ScInputStatusItem : public SfxPoolItem +// class ScSortItem : public SfxPoolItem +// class ScQueryItem : public SfxPoolItem +// class ScSubTotalItem : public SfxPoolItem +// class cUserListItem : public SfxPoolItem +// class ScConsolidateItem : public SfxPoolItem +// class ScPivotItem : public SfxPoolItem +// class ScSolveItem : public SfxPoolItem +// class ScTabOpItem : public SfxPoolItem +// class SdOptionsLayoutItem : public SfxPoolItem +// class SdOptionsMiscItem : public SfxPoolItem +// class SdOptionsSnapItem : public SfxPoolItem +// class SdOptionsPrintItem : public SfxPoolItem +// class SwCondCollItem : public SfxPoolItem +// class SwTableBoxFormula : public SfxPoolItem, public SwTableFormula +// class SwTableBoxValue : public SfxPoolItem +// class SwFormatCharFormat: public SfxPoolItem, public SwClient +// class SwFormatAnchor: public SfxPoolItem +// class SwFormatAutoFormat: public SfxPoolItem +// class SwFormatCol : public SfxPoolItem +// class SwFormatChain: public SfxPoolItem +// class SwFormatContent: public SfxPoolItem +// class SwFormatFlyCnt : public SfxPoolItem +// class SwFormatField : public SfxPoolItem +// class SwFormatFootnote : public SfxPoolItem +// class SwFormatHeader: public SfxPoolItem, public SwClient +// class SwFormatFooter: public SfxPoolItem, public SwClient +// class SwFormatINetFormat : public SfxPoolItem +// class SwFormatLineNumber: public SfxPoolItem +// class SwFormatMeta : public SfxPoolItem +// class SwFormatVertOrient: public SfxPoolItem +// class SwFormatHoriOrient: public SfxPoolItem +// class SwFormatPageDesc : public SfxPoolItem, public SwClient +// class SwFormatRefMark : public SfxPoolItem +// class SwFormatRuby : public SfxPoolItem +// class SwFormatURL: public SfxPoolItem +// class SwFormatWrapInfluenceOnObjPos: public SfxPoolItem +// class SwGammaGrf : public SfxPoolItem +// class SwMsgPoolItem : public SfxPoolItem +// class SwPtrMsgPoolItem : public SwMsgPoolItem +// class SwFormatChg: public SwMsgPoolItem +// class SwInsText: public SwMsgPoolItem +// class SwDelChr: public SwMsgPoolItem +// class SwDelText: public SwMsgPoolItem +// class SwUpdateAttr : public SwMsgPoolItem +// class SwRefMarkFieldUpdate : public SwMsgPoolItem +// class SwDocPosUpdate : public SwMsgPoolItem +// class SwTableFormulaUpdate : public SwMsgPoolItem +// class SwAutoFormatGetDocNode: public SwMsgPoolItem +// class SwAttrSetChg: public SwMsgPoolItem +// class SwCondCollCondChg: public SwMsgPoolItem +// class SwVirtPageNumInfo: public SwMsgPoolItem +// class SwFindNearestNode : public SwMsgPoolItem +// class SwStringMsgPoolItem : public SwMsgPoolItem +// class SwFormatDrop: public SfxPoolItem, public SwClient +// class SwTextGridItem : public SfxPoolItem +// class SwTOXMark : public SfxPoolItem +// class SwFltAnchor : public SfxPoolItem +// class SwFltRedline : public SfxPoolItem +// class SwFltBookmark : public SfxPoolItem +// class SwFltRDFMark : public SfxPoolItem +// class SwFltTOX : public SfxPoolItem +// class SwDocDisplayItem : public SfxPoolItem +// class SwElemItem : public SfxPoolItem +// class SwAddPrinterItem : public SfxPoolItem, public SwPrintData +// class SwShadowCursorItem : public SfxPoolItem +// class SwTestItem : public SfxPoolItem +// class SwEnvItem : public SfxPoolItem +// class SwLabItem : public SfxPoolItem +// class SwWrtShellItem: public SfxPoolItem +// class SwPageFootnoteInfoItem : public SfxPoolItem +// class SwPtrItem : public SfxPoolItem +// class SwUINumRuleItem : public SfxPoolItem +// class SwPaMItem : public SfxPoolItem +////////////////////////////////////////////////////////////////////////////// + SfxPoolItem::SfxPoolItem(sal_uInt16 const nWhich) : m_nRefCount(0) , m_nWhich(nWhich) @@ -48,25 +492,6 @@ bool SfxPoolItem::operator==( const SfxPoolItem& rCmp ) const } -SfxPoolItem* SfxPoolItem::Create(SvStream &, sal_uInt16) const -{ - assert(!"this item is not serialisable"); - return Clone(); -} - - -sal_uInt16 SfxPoolItem::GetVersion( sal_uInt16 ) const -{ - return 0; -} - - -SvStream& SfxPoolItem::Store(SvStream &rStream, sal_uInt16 ) const -{ - assert(!"this item is not serialisable"); - return rStream; -} - /** * This virtual method allows to get a textual representation of the value * for the SfxPoolItem subclasses. It should be overridden by all UI-relevant diff --git a/svl/source/items/ptitem.cxx b/svl/source/items/ptitem.cxx index 03493d143e04..ed228db34e87 100644 --- a/svl/source/items/ptitem.cxx +++ b/svl/source/items/ptitem.cxx @@ -73,21 +73,6 @@ SfxPoolItem* SfxPointItem::Clone(SfxItemPool *) const } -SfxPoolItem* SfxPointItem::Create(SvStream &rStream, sal_uInt16 ) const -{ - Point aStr; - ReadPair( rStream, aStr ); - return new SfxPointItem(Which(), aStr); -} - - -SvStream& SfxPointItem::Store(SvStream &rStream, sal_uInt16 ) const -{ - WritePair( rStream, aVal ); - return rStream; -} - - bool SfxPointItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { diff --git a/svl/source/items/rectitem.cxx b/svl/source/items/rectitem.cxx index d481a78df22d..170bf76db521 100644 --- a/svl/source/items/rectitem.cxx +++ b/svl/source/items/rectitem.cxx @@ -73,21 +73,6 @@ SfxPoolItem* SfxRectangleItem::Clone(SfxItemPool *) const } -SfxPoolItem* SfxRectangleItem::Create(SvStream &rStream, sal_uInt16 ) const -{ - tools::Rectangle aStr; - ReadRectangle( rStream, aStr ); - return new SfxRectangleItem(Which(), aStr); -} - - -SvStream& SfxRectangleItem::Store(SvStream &rStream, sal_uInt16 ) const -{ - WriteRectangle( rStream, aVal ); - return rStream; -} - - bool SfxRectangleItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId) const { diff --git a/svl/source/items/rngitem.cxx b/svl/source/items/rngitem.cxx index 6b0a3768d555..1cabc517eb79 100644 --- a/svl/source/items/rngitem.cxx +++ b/svl/source/items/rngitem.cxx @@ -59,21 +59,4 @@ SfxPoolItem* SfxRangeItem::Clone(SfxItemPool *) const return new SfxRangeItem( Which(), nFrom, nTo ); } - -SfxPoolItem* SfxRangeItem::Create(SvStream &rStream, sal_uInt16) const -{ - sal_uInt16 nVon(0), nBis(0); - rStream.ReadUInt16( nVon ); - rStream.ReadUInt16( nBis ); - return new SfxRangeItem( Which(), nVon, nBis ); -} - - -SvStream& SfxRangeItem::Store(SvStream &rStream, sal_uInt16) const -{ - rStream.WriteUInt16( nFrom ); - rStream.WriteUInt16( nTo ); - return rStream; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svl/source/items/slstitm.cxx b/svl/source/items/slstitm.cxx index 64d960226d86..e366badc8167 100644 --- a/svl/source/items/slstitm.cxx +++ b/svl/source/items/slstitm.cxx @@ -47,24 +47,6 @@ SfxStringListItem::SfxStringListItem( sal_uInt16 which, const std::vector<OUStri } -SfxStringListItem::SfxStringListItem( sal_uInt16 which, SvStream& rStream ) : - SfxPoolItem( which ) -{ - sal_Int32 nEntryCount; - rStream.ReadInt32( nEntryCount ); - - if( nEntryCount ) - mpList.reset(new std::vector<OUString>); - - if (mpList) - { - for( sal_Int32 i=0; i < nEntryCount; i++ ) - { - mpList->push_back( readByteString(rStream) ); - } - } -} - SfxStringListItem::~SfxStringListItem() { } @@ -113,30 +95,6 @@ SfxPoolItem* SfxStringListItem::Clone( SfxItemPool *) const } -SfxPoolItem* SfxStringListItem::Create( SvStream & rStream, sal_uInt16 ) const -{ - return new SfxStringListItem( Which(), rStream ); -} - - -SvStream& SfxStringListItem::Store( SvStream & rStream, sal_uInt16 ) const -{ - if( !mpList ) - { - rStream.WriteInt32( 0 ); - return rStream; - } - - sal_uInt32 nCount = mpList->size(); - rStream.WriteUInt32( nCount ); - - for( sal_uInt32 i=0; i < nCount; i++ ) - writeByteString(rStream, (*mpList)[i]); - - return rStream; -} - - void SfxStringListItem::SetString( const OUString& rStr ) { mpList.reset( new std::vector<OUString> ); diff --git a/svl/source/items/stritem.cxx b/svl/source/items/stritem.cxx index 37ed45c4a7f8..131e468e6b99 100644 --- a/svl/source/items/stritem.cxx +++ b/svl/source/items/stritem.cxx @@ -25,27 +25,6 @@ // virtual -SfxStringItem::SfxStringItem(sal_uInt16 which, SvStream & rStream): - CntUnencodedStringItem(which) -{ - SetValue(readByteString(rStream)); -} - - -// virtual -SfxPoolItem * SfxStringItem::Create(SvStream & rStream, sal_uInt16) const -{ - return new SfxStringItem(Which(), rStream); -} - -// virtual -SvStream & SfxStringItem::Store(SvStream & rStream, sal_uInt16) const -{ - writeByteString(rStream, GetValue()); - return rStream; -} - -// virtual SfxPoolItem * SfxStringItem::Clone(SfxItemPool *) const { return new SfxStringItem(*this); diff --git a/svl/source/items/visitem.cxx b/svl/source/items/visitem.cxx index d35fc6078db2..d1ad3efc01a2 100644 --- a/svl/source/items/visitem.cxx +++ b/svl/source/items/visitem.cxx @@ -23,14 +23,6 @@ #include <tools/stream.hxx> -SfxVisibilityItem::SfxVisibilityItem(sal_uInt16 which, SvStream & rStream): - SfxPoolItem(which) -{ - bool bValue = false; - rStream.ReadCharAsBool( bValue ); - m_nValue.bVisible = bValue; -} - // virtual bool SfxVisibilityItem::operator ==(const SfxPoolItem & rItem) const { @@ -68,19 +60,6 @@ bool SfxVisibilityItem::PutValue(const css::uno::Any& rVal, sal_uInt8) } // virtual -SfxPoolItem * SfxVisibilityItem::Create(SvStream & rStream, sal_uInt16) const -{ - return new SfxVisibilityItem(Which(), rStream); -} - -// virtual -SvStream & SfxVisibilityItem::Store(SvStream & rStream, sal_uInt16) const -{ - rStream.WriteUChar( m_nValue.bVisible ); - return rStream; -} - -// virtual SfxPoolItem * SfxVisibilityItem::Clone(SfxItemPool *) const { return new SfxVisibilityItem(*this); diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk index 4677f3b475f4..6589179eb025 100644 --- a/svx/Library_svx.mk +++ b/svx/Library_svx.mk @@ -160,8 +160,10 @@ $(eval $(call gb_Library_add_exception_objects,svx,\ svx/source/dialog/txenctab \ svx/source/engine3d/float3d \ svx/source/items/algitem \ + svx/source/items/autoformathelper \ svx/source/items/hlnkitem \ svx/source/items/numfmtsh \ + svx/source/items/legacyitem \ svx/source/items/numinf \ svx/source/items/ofaitem \ svx/source/items/pageitem \ diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx index 8141ec50b80f..04cd33c9d327 100644 --- a/svx/source/dialog/svxruler.cxx +++ b/svx/source/dialog/svxruler.cxx @@ -131,7 +131,7 @@ struct SvxRuler_Impl { long lMaxRightLogic; long lLastLMargin; long lLastRMargin; - SvxProtectItem aProtectItem; + std::unique_ptr<SvxProtectItem> aProtectItem; std::unique_ptr<SfxBoolItem> pTextRTLItem; sal_uInt16 nControlerItems; sal_uInt16 nIdx; @@ -148,7 +148,8 @@ struct SvxRuler_Impl { SvxRuler_Impl() : nPercSize(0), nTotalDist(0), lOldWinPos(0), lMaxLeftLogic(0), lMaxRightLogic(0), - lLastLMargin(0), lLastRMargin(0), aProtectItem(SID_RULER_PROTECT), + lLastLMargin(0), lLastRMargin(0), + aProtectItem(std::make_unique<SvxProtectItem>(SID_RULER_PROTECT)), nControlerItems(0), nIdx(0), nColLeftPix(0), nColRightPix(0), bIsTableRows(false), @@ -498,8 +499,8 @@ inline sal_uInt16 SvxRuler::GetObjectBordersOff(sal_uInt16 nIdx) const void SvxRuler::UpdateFrame() { const RulerMarginStyle nMarginStyle = - ( mxRulerImpl->aProtectItem.IsSizeProtected() || - mxRulerImpl->aProtectItem.IsPosProtected() ) ? + ( mxRulerImpl->aProtectItem->IsSizeProtected() || + mxRulerImpl->aProtectItem->IsPosProtected() ) ? RulerMarginStyle::NONE : RulerMarginStyle::Sizeable; if(mxLRSpaceItem.get() && mxPagePosItem.get()) @@ -745,7 +746,7 @@ void SvxRuler::UpdateFrame(const SvxLongULSpaceItem *pItem) // new value void SvxRuler::Update( const SvxProtectItem* pItem ) { if( pItem ) - mxRulerImpl->aProtectItem = *pItem; + mxRulerImpl->aProtectItem.reset(static_cast<SvxProtectItem*>(pItem->Clone())); } void SvxRuler::UpdateTextRTL(const SfxBoolItem* pItem) @@ -800,8 +801,8 @@ void SvxRuler::UpdateColumns() RulerBorderStyle nStyleFlags = RulerBorderStyle::Variable; bool bProtectColumns = - mxRulerImpl->aProtectItem.IsSizeProtected() || - mxRulerImpl->aProtectItem.IsPosProtected(); + mxRulerImpl->aProtectItem->IsSizeProtected() || + mxRulerImpl->aProtectItem->IsPosProtected(); if( !bProtectColumns ) { @@ -1392,8 +1393,8 @@ void SvxRuler::AdjustMargin1(long lInputDiff) const long lDragPos = lInputDiff; bool bProtectColumns = - mxRulerImpl->aProtectItem.IsSizeProtected() || - mxRulerImpl->aProtectItem.IsPosProtected(); + mxRulerImpl->aProtectItem->IsSizeProtected() || + mxRulerImpl->aProtectItem->IsPosProtected(); const RulerMarginStyle nMarginStyle = bProtectColumns ? RulerMarginStyle::NONE : RulerMarginStyle::Sizeable; @@ -1524,8 +1525,8 @@ void SvxRuler::DragMargin2() } bool bProtectColumns = - mxRulerImpl->aProtectItem.IsSizeProtected() || - mxRulerImpl->aProtectItem.IsPosProtected(); + mxRulerImpl->aProtectItem->IsSizeProtected() || + mxRulerImpl->aProtectItem->IsPosProtected(); const RulerMarginStyle nMarginStyle = bProtectColumns ? RulerMarginStyle::NONE : RulerMarginStyle::Sizeable; @@ -2549,7 +2550,7 @@ void SvxRuler::Click() if(mxTabStopItem.get() && (nFlags & SvxRulerSupportFlags::TABS) == SvxRulerSupportFlags::TABS) { - bool bContentProtected = mxRulerImpl->aProtectItem.IsContentProtected(); + bool bContentProtected = mxRulerImpl->aProtectItem->IsContentProtected(); if( bContentProtected ) return; const long lPos = GetClickPos(); if((bRTL && lPos < std::min(GetFirstLineIndent(), GetLeftIndent()) && lPos > GetRightIndent()) || @@ -2613,7 +2614,7 @@ void SvxRuler::CalcMinMax() { //top border is not moveable when table rows are displayed // protection of content means the margin is not moveable - if(bHorz && !mxRulerImpl->aProtectItem.IsContentProtected()) + if(bHorz && !mxRulerImpl->aProtectItem->IsContentProtected()) { nMaxLeft = mpBorders[0].nMinPos + lNullPix; if(nDragType & SvxRulerDragFlags::OBJECT_SIZE_PROPORTIONAL) @@ -2701,7 +2702,7 @@ void SvxRuler::CalcMinMax() { // get the bottom move range from the last border position - only available for rows! // protection of content means the margin is not moveable - if(bHorz || mxRulerImpl->aProtectItem.IsContentProtected()) + if(bHorz || mxRulerImpl->aProtectItem->IsContentProtected()) { nMaxLeft = nMaxRight = mpBorders[mxColumnItem->Count() - 1].nMaxPos + lNullPix; } @@ -3109,7 +3110,7 @@ bool SvxRuler::StartDrag() <SvxRuler::CalcMinMax()> <SvxRuler::EndDrag()> */ - bool bContentProtected = mxRulerImpl->aProtectItem.IsContentProtected(); + bool bContentProtected = mxRulerImpl->aProtectItem->IsContentProtected(); if(!bValid) return false; diff --git a/svx/source/engine3d/svx3ditems.cxx b/svx/source/engine3d/svx3ditems.cxx index 8b1efe4dfc44..8fe5b55948b0 100644 --- a/svx/source/engine3d/svx3ditems.cxx +++ b/svx/source/engine3d/svx3ditems.cxx @@ -35,11 +35,6 @@ Svx3DReducedLineGeometryItem::Svx3DReducedLineGeometryItem(bool bVal) : SfxBoolItem(SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY, bVal) {} -sal_uInt16 Svx3DReducedLineGeometryItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const -{ - return 1; -} - SfxPoolItem * Svx3DReducedLineGeometryItem::Clone(SfxItemPool *) const { return new Svx3DReducedLineGeometryItem(*this); @@ -78,11 +73,6 @@ Svx3DSmoothNormalsItem::Svx3DSmoothNormalsItem(bool bVal) : SfxBoolItem(SDRATTR_3DOBJ_SMOOTH_NORMALS, bVal) {} -sal_uInt16 Svx3DSmoothNormalsItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const -{ - return 1; -} - SfxPoolItem * Svx3DSmoothNormalsItem::Clone(SfxItemPool *) const { return new Svx3DSmoothNormalsItem(*this); @@ -93,11 +83,6 @@ Svx3DSmoothLidsItem::Svx3DSmoothLidsItem(bool bVal) : SfxBoolItem(SDRATTR_3DOBJ_SMOOTH_LIDS, bVal) {} -sal_uInt16 Svx3DSmoothLidsItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const -{ - return 1; -} - SfxPoolItem * Svx3DSmoothLidsItem::Clone(SfxItemPool *) const { return new Svx3DSmoothLidsItem(*this); @@ -108,11 +93,6 @@ Svx3DCharacterModeItem::Svx3DCharacterModeItem(bool bVal) : SfxBoolItem(SDRATTR_3DOBJ_CHARACTER_MODE, bVal) {} -sal_uInt16 Svx3DCharacterModeItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const -{ - return 1; -} - SfxPoolItem * Svx3DCharacterModeItem::Clone(SfxItemPool *) const { return new Svx3DCharacterModeItem(*this); @@ -123,11 +103,6 @@ Svx3DCloseFrontItem::Svx3DCloseFrontItem(bool bVal) : SfxBoolItem(SDRATTR_3DOBJ_CLOSE_FRONT, bVal) {} -sal_uInt16 Svx3DCloseFrontItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const -{ - return 1; -} - SfxPoolItem * Svx3DCloseFrontItem::Clone(SfxItemPool *) const { return new Svx3DCloseFrontItem(*this); @@ -138,11 +113,6 @@ Svx3DCloseBackItem::Svx3DCloseBackItem(bool bVal) : SfxBoolItem(SDRATTR_3DOBJ_CLOSE_BACK, bVal) {} -sal_uInt16 Svx3DCloseBackItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const -{ - return 1; -} - SfxPoolItem * Svx3DCloseBackItem::Clone(SfxItemPool *) const { return new Svx3DCloseBackItem(*this); diff --git a/svx/source/items/algitem.cxx b/svx/source/items/algitem.cxx index 4d9a7baecebd..ef11c6a9408b 100644 --- a/svx/source/items/algitem.cxx +++ b/svx/source/items/algitem.cxx @@ -133,14 +133,6 @@ SfxPoolItem* SvxOrientationItem::Clone( SfxItemPool* ) const } -SfxPoolItem* SvxOrientationItem::Create( SvStream& rStream, sal_uInt16 ) const -{ - sal_uInt16 nVal; - rStream.ReadUInt16( nVal ); - return new SvxOrientationItem( static_cast<SvxCellOrientation>(nVal), Which() ); -} - - sal_uInt16 SvxOrientationItem::GetValueCount() const { return static_cast<sal_uInt16>(SvxCellOrientation::Stacked) + 1; // last enum value + 1 @@ -256,30 +248,6 @@ SfxPoolItem* SvxMarginItem::Clone( SfxItemPool* ) const } -SfxPoolItem* SvxMarginItem::Create( SvStream& rStream, sal_uInt16 ) const -{ - sal_Int16 nLeft; - sal_Int16 nTop; - sal_Int16 nRight; - sal_Int16 nBottom; - rStream.ReadInt16( nLeft ); - rStream.ReadInt16( nTop ); - rStream.ReadInt16( nRight ); - rStream.ReadInt16( nBottom ); - return new SvxMarginItem( nLeft, nTop, nRight, nBottom, Which() ); -} - - -SvStream& SvxMarginItem::Store( SvStream &rStream, sal_uInt16 /*nItemVersion*/) const -{ - rStream.WriteInt16( nLeftMargin ); - rStream.WriteInt16( nTopMargin ); - rStream.WriteInt16( nRightMargin ); - rStream.WriteInt16( nBottomMargin ); - return rStream; -} - - bool SvxMarginItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); diff --git a/svx/source/items/autoformathelper.cxx b/svx/source/items/autoformathelper.cxx new file mode 100755 index 000000000000..1304ab0a25a6 --- /dev/null +++ b/svx/source/items/autoformathelper.cxx @@ -0,0 +1,380 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <svx/autoformathelper.hxx> +#include <tools/stream.hxx> +#include <svl/legacyitem.hxx> +#include <editeng/legacyitem.hxx> +#include <svx/legacyitem.hxx> +#include <editeng/fontitem.hxx> +#include <editeng/fhgtitem.hxx> +#include <editeng/wghtitem.hxx> +#include <editeng/postitem.hxx> +#include <editeng/udlnitem.hxx> +#include <editeng/crossedoutitem.hxx> +#include <editeng/contouritem.hxx> +#include <editeng/shdditem.hxx> +#include <editeng/colritem.hxx> +#include <editeng/boxitem.hxx> +#include <editeng/lineitem.hxx> +#include <editeng/brushitem.hxx> +#include <editeng/adjustitem.hxx> +#include <editeng/justifyitem.hxx> +#include <svl/eitem.hxx> +#include <svx/algitem.hxx> +#include <svl/intitem.hxx> +#include <svx/rotmodit.hxx> +#include <osl/thread.h> + +////////////////////////////////////////////////////////////////////////////// + +AutoFormatVersions::AutoFormatVersions() +: 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), + nNumFormatVersion(0) +{ +} + +const sal_uInt16 AUTOFORMAT_ID_300OVRLN = 10031; +const sal_uInt16 AUTOFORMAT_ID_680DR14 = 10011; +const sal_uInt16 AUTOFORMAT_ID_504 = 9801; + +void AutoFormatVersions::LoadBlockA( 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 ); +} + +void AutoFormatVersions::LoadBlockB( SvStream& rStream, sal_uInt16 nVer ) +{ + 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.ReadUInt16( nNumFormatVersion ); +} + +void AutoFormatVersions::WriteBlockA(SvStream& rStream, sal_uInt16 fileVersion) +{ + rStream.WriteUInt16(legacy::SvxFont::GetVersion(fileVersion)); + rStream.WriteUInt16(legacy::SvxFontHeight::GetVersion(fileVersion)); + rStream.WriteUInt16(legacy::SvxWeight::GetVersion(fileVersion)); + rStream.WriteUInt16(legacy::SvxPosture::GetVersion(fileVersion)); + rStream.WriteUInt16(legacy::SvxTextLine::GetVersion(fileVersion)); + rStream.WriteUInt16(legacy::SvxTextLine::GetVersion(fileVersion)); + rStream.WriteUInt16(legacy::SvxCrossedOut::GetVersion(fileVersion)); + rStream.WriteUInt16(legacy::SfxBool::GetVersion(fileVersion)); + rStream.WriteUInt16(legacy::SfxBool::GetVersion(fileVersion)); + rStream.WriteUInt16(legacy::SvxColor::GetVersion(fileVersion)); + rStream.WriteUInt16(legacy::SvxBox::GetVersion(fileVersion)); + rStream.WriteUInt16(legacy::SvxLine::GetVersion(fileVersion)); + rStream.WriteUInt16(legacy::SvxBrush::GetVersion(fileVersion)); + rStream.WriteUInt16(legacy::SvxAdjust::GetVersion(fileVersion)); +} + +void AutoFormatVersions::WriteBlockB(SvStream& rStream, sal_uInt16 fileVersion) +{ + rStream.WriteUInt16(legacy::SvxHorJustify::GetVersion(fileVersion)); + rStream.WriteUInt16(legacy::SvxVerJustify::GetVersion(fileVersion)); + rStream.WriteUInt16(legacy::SvxOrientation::GetVersion(fileVersion)); + rStream.WriteUInt16(legacy::SvxMargin::GetVersion(fileVersion)); + rStream.WriteUInt16(legacy::SfxBool::GetVersion(fileVersion)); + rStream.WriteUInt16(legacy::CntInt32::GetVersion(fileVersion)); + rStream.WriteUInt16(legacy::SvxRotateMode::GetVersion(fileVersion)); + rStream.WriteUInt16( 0 ); // NumberFormat +} + +////////////////////////////////////////////////////////////////////////////// + +void AutoFormatBase::SetFont( const SvxFontItem& rNew ) { m_aFont.reset(static_cast<SvxFontItem*>(rNew.Clone())); } +void AutoFormatBase::SetHeight( const SvxFontHeightItem& rNew ) { m_aHeight.reset(static_cast<SvxFontHeightItem*>(rNew.Clone())); } +void AutoFormatBase::SetWeight( const SvxWeightItem& rNew ) { m_aWeight.reset(static_cast<SvxWeightItem*>(rNew.Clone())); } +void AutoFormatBase::SetPosture( const SvxPostureItem& rNew ) { m_aPosture.reset(static_cast<SvxPostureItem*>(rNew.Clone())); } +void AutoFormatBase::SetCJKFont( const SvxFontItem& rNew ) { m_aCJKFont.reset(static_cast<SvxFontItem*>(rNew.Clone())); } +void AutoFormatBase::SetCJKHeight( const SvxFontHeightItem& rNew ) { m_aCJKHeight.reset(static_cast<SvxFontHeightItem*>(rNew.Clone())); } +void AutoFormatBase::SetCJKWeight( const SvxWeightItem& rNew ) { m_aCJKWeight.reset(static_cast<SvxWeightItem*>(rNew.Clone())); } +void AutoFormatBase::SetCJKPosture( const SvxPostureItem& rNew ) { m_aCJKPosture.reset(static_cast<SvxPostureItem*>(rNew.Clone())); } +void AutoFormatBase::SetCTLFont( const SvxFontItem& rNew ) { m_aCTLFont.reset(static_cast<SvxFontItem*>(rNew.Clone())); } +void AutoFormatBase::SetCTLHeight( const SvxFontHeightItem& rNew ) { m_aCTLHeight.reset(static_cast<SvxFontHeightItem*>(rNew.Clone())); } +void AutoFormatBase::SetCTLWeight( const SvxWeightItem& rNew ) { m_aCTLWeight.reset(static_cast<SvxWeightItem*>(rNew.Clone())); } +void AutoFormatBase::SetCTLPosture( const SvxPostureItem& rNew ) { m_aCTLPosture.reset(static_cast<SvxPostureItem*>(rNew.Clone())); } +void AutoFormatBase::SetUnderline( const SvxUnderlineItem& rNew ) { m_aUnderline.reset(static_cast<SvxUnderlineItem*>(rNew.Clone())); } +void AutoFormatBase::SetOverline( const SvxOverlineItem& rNew ) { m_aOverline.reset(static_cast<SvxOverlineItem*>(rNew.Clone())); } +void AutoFormatBase::SetCrossedOut( const SvxCrossedOutItem& rNew ) { m_aCrossedOut.reset(static_cast<SvxCrossedOutItem*>(rNew.Clone())); } +void AutoFormatBase::SetContour( const SvxContourItem& rNew ) { m_aContour.reset(static_cast<SvxContourItem*>(rNew.Clone())); } +void AutoFormatBase::SetShadowed( const SvxShadowedItem& rNew ) { m_aShadowed.reset(static_cast<SvxShadowedItem*>(rNew.Clone())); } +void AutoFormatBase::SetColor( const SvxColorItem& rNew ) { m_aColor.reset(static_cast<SvxColorItem*>(rNew.Clone())); } +void AutoFormatBase::SetBox( const SvxBoxItem& rNew ) { m_aBox.reset(static_cast<SvxBoxItem*>(rNew.Clone())); } +void AutoFormatBase::SetTLBR( const SvxLineItem& rNew ) { m_aTLBR.reset(static_cast<SvxLineItem*>(rNew.Clone())); } +void AutoFormatBase::SetBLTR( const SvxLineItem& rNew ) { m_aBLTR.reset(static_cast<SvxLineItem*>(rNew.Clone())); } +void AutoFormatBase::SetBackground( const SvxBrushItem& rNew ) { m_aBackground.reset(static_cast<SvxBrushItem*>(rNew.Clone())); } +void AutoFormatBase::SetAdjust( const SvxAdjustItem& rNew ) { m_aAdjust.reset(static_cast<SvxAdjustItem*>(rNew.Clone())); } +void AutoFormatBase::SetHorJustify( const SvxHorJustifyItem& rNew ) { m_aHorJustify.reset(static_cast<SvxHorJustifyItem*>(rNew.Clone())); } +void AutoFormatBase::SetVerJustify( const SvxVerJustifyItem& rNew ) { m_aVerJustify.reset(static_cast<SvxVerJustifyItem*>(rNew.Clone())); } +void AutoFormatBase::SetStacked( const SfxBoolItem& rNew ) { m_aStacked.reset(static_cast<SfxBoolItem*>(rNew.Clone())); } +void AutoFormatBase::SetMargin( const SvxMarginItem& rNew ) { m_aMargin.reset(static_cast<SvxMarginItem*>(rNew.Clone())); } +void AutoFormatBase::SetLinebreak( const SfxBoolItem& rNew ) { m_aLinebreak.reset(static_cast<SfxBoolItem*>(rNew.Clone())); } +void AutoFormatBase::SetRotateAngle( const SfxInt32Item& rNew ) { m_aRotateAngle.reset(static_cast<SfxInt32Item*>(rNew.Clone())); } +void AutoFormatBase::SetRotateMode( const SvxRotateModeItem& rNew ) { m_aRotateMode.reset(static_cast<SvxRotateModeItem*>(rNew.Clone())); } + +AutoFormatBase::AutoFormatBase() +: m_aFont(), + m_aHeight(), + m_aWeight(), + m_aPosture(), + m_aCJKFont(), + m_aCJKHeight(), + m_aCJKWeight(), + m_aCJKPosture(), + m_aCTLFont(), + m_aCTLHeight(), + m_aCTLWeight(), + m_aCTLPosture(), + m_aUnderline(), + m_aOverline(), + m_aCrossedOut(), + m_aContour(), + m_aShadowed(), + m_aColor(), + m_aBox(), + m_aTLBR(), + m_aBLTR(), + m_aBackground(), + m_aAdjust(), + m_aHorJustify(), + m_aVerJustify(), + m_aStacked(), + m_aMargin(), + m_aLinebreak(), + m_aRotateAngle(), + m_aRotateMode() +{ +} + +AutoFormatBase::AutoFormatBase( const AutoFormatBase& rNew ) +: m_aFont(static_cast<SvxFontItem*>(rNew.m_aFont->Clone())), + m_aHeight(static_cast<SvxFontHeightItem*>(rNew.m_aHeight->Clone())), + m_aWeight(static_cast<SvxWeightItem*>(rNew.m_aWeight->Clone())), + m_aPosture(static_cast<SvxPostureItem*>(rNew.m_aPosture->Clone())), + m_aCJKFont(static_cast<SvxFontItem*>(rNew.m_aCJKFont->Clone())), + m_aCJKHeight(static_cast<SvxFontHeightItem*>(rNew.m_aCJKHeight->Clone())), + m_aCJKWeight(static_cast<SvxWeightItem*>(rNew.m_aCJKWeight->Clone())), + m_aCJKPosture(static_cast<SvxPostureItem*>(rNew.m_aCJKPosture->Clone())), + m_aCTLFont(static_cast<SvxFontItem*>(rNew.m_aCTLFont->Clone())), + m_aCTLHeight(static_cast<SvxFontHeightItem*>(rNew.m_aCTLHeight->Clone())), + m_aCTLWeight(static_cast<SvxWeightItem*>(rNew.m_aCTLWeight->Clone())), + m_aCTLPosture(static_cast<SvxPostureItem*>(rNew.m_aCTLPosture->Clone())), + m_aUnderline(static_cast<SvxUnderlineItem*>(rNew.m_aUnderline->Clone())), + m_aOverline(static_cast<SvxOverlineItem*>(rNew.m_aOverline->Clone())), + m_aCrossedOut(static_cast<SvxCrossedOutItem*>(rNew.m_aCrossedOut->Clone())), + m_aContour(static_cast<SvxContourItem*>(rNew.m_aContour->Clone())), + m_aShadowed(static_cast<SvxShadowedItem*>(rNew.m_aShadowed->Clone())), + m_aColor(static_cast<SvxColorItem*>(rNew.m_aColor->Clone())), + m_aBox(static_cast<SvxBoxItem*>(rNew.m_aBox->Clone())), + m_aTLBR(static_cast<SvxLineItem*>(rNew.m_aTLBR->Clone())), + m_aBLTR(static_cast<SvxLineItem*>(rNew.m_aBLTR->Clone())), + m_aBackground(static_cast<SvxBrushItem*>(rNew.m_aBackground->Clone())), + m_aAdjust(static_cast<SvxAdjustItem*>(rNew.m_aAdjust->Clone())), + m_aHorJustify(static_cast<SvxHorJustifyItem*>(rNew.m_aHorJustify->Clone())), + m_aVerJustify(static_cast<SvxVerJustifyItem*>(rNew.m_aVerJustify->Clone())), + m_aStacked(static_cast<SfxBoolItem*>(rNew.m_aStacked->Clone())), + m_aMargin(static_cast<SvxMarginItem*>(rNew.m_aMargin->Clone())), + m_aLinebreak(static_cast<SfxBoolItem*>(rNew.m_aLinebreak->Clone())), + m_aRotateAngle(static_cast<SfxInt32Item*>(rNew.m_aRotateAngle->Clone())), + m_aRotateMode(static_cast<SvxRotateModeItem*>(rNew.m_aRotateMode->Clone())) +{ +} + +AutoFormatBase::~AutoFormatBase() +{ +} + +const sal_uInt16 AUTOFORMAT_DATA_ID_641 = 10002; +const sal_uInt16 AUTOFORMAT_DATA_ID_300OVRLN = 10032; +const sal_uInt16 AUTOFORMAT_DATA_ID_680DR14 = 10012; +const sal_uInt16 AUTOFORMAT_DATA_ID_504 = 9802; + +bool AutoFormatBase::LoadBlockA( SvStream& rStream, const AutoFormatVersions& rVersions, sal_uInt16 nVer ) +{ + legacy::SvxFont::Create(*m_aFont, rStream, rVersions.nFontVersion); + + if( rStream.GetStreamCharSet() == m_aFont->GetCharSet() ) + { + m_aFont->SetCharSet(::osl_getThreadTextEncoding()); + } + + legacy::SvxFontHeight::Create(*m_aHeight, rStream, rVersions.nFontHeightVersion); + legacy::SvxWeight::Create(*m_aWeight, rStream, rVersions.nWeightVersion); + legacy::SvxPosture::Create(*m_aPosture, rStream, rVersions.nPostureVersion); + + // --- from 641 on: CJK and CTL font settings + if( AUTOFORMAT_DATA_ID_641 <= nVer ) + { + legacy::SvxFont::Create(*m_aCJKFont, rStream, rVersions.nFontVersion); + legacy::SvxFontHeight::Create(*m_aCJKHeight, rStream, rVersions.nFontHeightVersion); + legacy::SvxWeight::Create(*m_aCJKWeight, rStream, rVersions.nWeightVersion); + legacy::SvxPosture::Create(*m_aCJKPosture, rStream, rVersions.nPostureVersion); + + legacy::SvxFont::Create(*m_aCTLFont, rStream, rVersions.nFontVersion); + legacy::SvxFontHeight::Create(*m_aCTLHeight, rStream, rVersions.nFontHeightVersion); + legacy::SvxWeight::Create(*m_aCTLWeight, rStream, rVersions.nWeightVersion); + legacy::SvxPosture::Create(*m_aCTLPosture, rStream, rVersions.nPostureVersion); + } + + legacy::SvxTextLine::Create(*m_aUnderline, rStream, rVersions.nUnderlineVersion); + + if( nVer >= AUTOFORMAT_DATA_ID_300OVRLN ) + { + legacy::SvxTextLine::Create(*m_aOverline, rStream, rVersions.nOverlineVersion); + } + + legacy::SvxCrossedOut::Create(*m_aCrossedOut, rStream, rVersions.nCrossedOutVersion); + legacy::SfxBool::Create(*m_aContour, rStream, rVersions.nContourVersion); + legacy::SfxBool::Create(*m_aShadowed, rStream, rVersions.nShadowedVersion); + legacy::SvxColor::Create(*m_aColor, rStream, rVersions.nColorVersion); + legacy::SvxBox::Create(*m_aBox, rStream, rVersions.nBoxVersion); + + // --- from 680/dr14 on: diagonal frame lines + if( nVer >= AUTOFORMAT_DATA_ID_680DR14 ) + { + legacy::SvxLine::Create(*m_aTLBR, rStream, rVersions.nLineVersion); + legacy::SvxLine::Create(*m_aBLTR, rStream, rVersions.nLineVersion); + } + + legacy::SvxBrush::Create(*m_aBackground, rStream, rVersions.nBrushVersion); + legacy::SvxAdjust::Create(*m_aAdjust, rStream, rVersions.nAdjustVersion); + + return ERRCODE_NONE == rStream.GetError(); +} + +bool AutoFormatBase::LoadBlockB( SvStream& rStream, const AutoFormatVersions& rVersions, sal_uInt16 nVer ) +{ + legacy::SvxHorJustify::Create(*m_aHorJustify, rStream, rVersions.nHorJustifyVersion); + legacy::SvxVerJustify::Create(*m_aVerJustify, rStream, rVersions.nVerJustifyVersion); + SvxOrientationItem aOrientation( SvxCellOrientation::Standard, 0); + legacy::SvxOrientation::Create(aOrientation, rStream, rVersions.nOrientationVersion); + legacy::SvxMargin::Create(*m_aMargin, rStream, rVersions.nMarginVersion); + legacy::SfxBool::Create(*m_aLinebreak, rStream, rVersions.nBoolVersion); + + if ( nVer >= AUTOFORMAT_DATA_ID_504 ) + { + legacy::CntInt32::Create(*m_aRotateAngle, rStream, rVersions.nInt32Version); + legacy::SvxRotateMode::Create(*m_aRotateMode, rStream, rVersions.nRotateModeVersion); + } + + m_aStacked->SetValue( aOrientation.IsStacked() ); + m_aRotateAngle->SetValue( aOrientation.GetRotation( m_aRotateAngle->GetValue() ) ); + + return ERRCODE_NONE == rStream.GetError(); +} + +bool AutoFormatBase::SaveBlockA( SvStream& rStream, sal_uInt16 fileVersion ) const +{ + legacy::SvxFont::Store(*m_aFont, rStream, legacy::SvxFont::GetVersion(fileVersion)); + legacy::SvxFontHeight::Store(*m_aHeight, rStream, legacy::SvxFontHeight::GetVersion(fileVersion)); + legacy::SvxWeight::Store(*m_aWeight, rStream, legacy::SvxWeight::GetVersion(fileVersion)); + legacy::SvxPosture::Store(*m_aPosture, rStream, legacy::SvxPosture::GetVersion(fileVersion)); + + // --- from 641 on: CJK and CTL font settings + legacy::SvxFont::Store(*m_aCJKFont, rStream, legacy::SvxFont::GetVersion(fileVersion)); + legacy::SvxFontHeight::Store(*m_aCJKHeight, rStream, legacy::SvxFontHeight::GetVersion(fileVersion)); + legacy::SvxWeight::Store(*m_aCJKWeight, rStream, legacy::SvxWeight::GetVersion(fileVersion)); + legacy::SvxPosture::Store(*m_aCJKPosture, rStream, legacy::SvxPosture::GetVersion(fileVersion)); + + legacy::SvxFont::Store(*m_aCTLFont, rStream, legacy::SvxFont::GetVersion(fileVersion)); + legacy::SvxFontHeight::Store(*m_aCTLHeight, rStream, legacy::SvxFontHeight::GetVersion(fileVersion)); + legacy::SvxWeight::Store(*m_aCTLWeight, rStream, legacy::SvxWeight::GetVersion(fileVersion)); + legacy::SvxPosture::Store(*m_aCTLPosture, rStream, legacy::SvxPosture::GetVersion(fileVersion)); + + legacy::SvxTextLine::Store(*m_aUnderline, rStream, legacy::SvxTextLine::GetVersion(fileVersion)); + + // --- from DEV300/overline2 on: overline support + legacy::SvxTextLine::Store(*m_aOverline, rStream, legacy::SvxTextLine::GetVersion(fileVersion)); + legacy::SvxCrossedOut::Store(*m_aCrossedOut, rStream, legacy::SvxCrossedOut::GetVersion(fileVersion)); + legacy::SfxBool::Store(*m_aContour, rStream, legacy::SfxBool::GetVersion(fileVersion)); + legacy::SfxBool::Store(*m_aShadowed, rStream, legacy::SfxBool::GetVersion(fileVersion)); + legacy::SvxColor::Store(*m_aColor, rStream, legacy::SvxColor::GetVersion(fileVersion)); + legacy::SvxBox::Store(*m_aBox, rStream, legacy::SvxBox::GetVersion(fileVersion)); + + // --- from 680/dr14 on: diagonal frame lines + legacy::SvxLine::Store(*m_aTLBR, rStream, legacy::SvxLine::GetVersion(fileVersion)); + legacy::SvxLine::Store(*m_aBLTR, rStream, legacy::SvxLine::GetVersion(fileVersion)); + legacy::SvxBrush::Store(*m_aBackground, rStream, legacy::SvxBrush::GetVersion(fileVersion)); + legacy::SvxAdjust::Store(*m_aAdjust, rStream, legacy::SvxAdjust::GetVersion(fileVersion)); + + return ERRCODE_NONE == rStream.GetError(); +} + +bool AutoFormatBase::SaveBlockB( SvStream& rStream, sal_uInt16 fileVersion ) const +{ + legacy::SvxHorJustify::Store(*m_aHorJustify, rStream, legacy::SvxHorJustify::GetVersion(fileVersion)); + legacy::SvxVerJustify::Store(*m_aVerJustify, rStream, legacy::SvxVerJustify::GetVersion(fileVersion)); + SvxOrientationItem aOrientation( m_aRotateAngle->GetValue(), m_aStacked->GetValue(), 0 ); + legacy::SvxOrientation::Store(aOrientation, rStream, legacy::SvxOrientation::GetVersion(fileVersion)); + legacy::SvxMargin::Store(*m_aMargin, rStream, legacy::SvxMargin::GetVersion(fileVersion)); + legacy::SfxBool::Store(*m_aLinebreak, rStream, legacy::SfxBool::GetVersion(fileVersion)); + + // Calc Rotation from SO5 + legacy::CntInt32::Store(*m_aRotateAngle, rStream, legacy::CntInt32::GetVersion(fileVersion)); + legacy::SvxRotateMode::Store(*m_aRotateMode, rStream, legacy::SvxRotateMode::GetVersion(fileVersion)); + + return ERRCODE_NONE == rStream.GetError(); +} + +////////////////////////////////////////////////////////////////////////////// +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/items/chrtitem.cxx b/svx/source/items/chrtitem.cxx index f4479727fa9b..5c128c6806a9 100644 --- a/svx/source/items/chrtitem.cxx +++ b/svx/source/items/chrtitem.cxx @@ -162,13 +162,6 @@ SfxPoolItem* SvxChartKindErrorItem::Clone(SfxItemPool* /*pPool*/) const } -sal_uInt16 SvxChartKindErrorItem::GetVersion (sal_uInt16 nFileFormatVersion) const -{ - return (nFileFormatVersion == SOFFICE_FILEFORMAT_31) - ? USHRT_MAX - : 0; -} - SvxChartIndicateItem::SvxChartIndicateItem(SvxChartIndicate eOrient, sal_uInt16 nId) : SfxEnumItem(nId, eOrient) @@ -182,13 +175,6 @@ SfxPoolItem* SvxChartIndicateItem::Clone(SfxItemPool* /*pPool*/) const } -sal_uInt16 SvxChartIndicateItem::GetVersion (sal_uInt16 nFileFormatVersion) const -{ - return (nFileFormatVersion == SOFFICE_FILEFORMAT_31) - ? USHRT_MAX - : 0; -} - SvxChartRegressItem::SvxChartRegressItem(SvxChartRegress eOrient, sal_uInt16 nId) : SfxEnumItem(nId, eOrient) @@ -202,12 +188,4 @@ SfxPoolItem* SvxChartRegressItem::Clone(SfxItemPool* /*pPool*/) const } -sal_uInt16 SvxChartRegressItem::GetVersion (sal_uInt16 nFileFormatVersion) const -{ - return (nFileFormatVersion == SOFFICE_FILEFORMAT_31) - ? USHRT_MAX - : 0; -} - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/items/customshapeitem.cxx b/svx/source/items/customshapeitem.cxx index fba55040dc37..329c2f09b7e0 100644 --- a/svx/source/items/customshapeitem.cxx +++ b/svx/source/items/customshapeitem.cxx @@ -265,15 +265,12 @@ SfxPoolItem* SdrCustomShapeGeometryItem::Clone( SfxItemPool * /*pPool*/ ) const return new SdrCustomShapeGeometryItem( aPropSeq ); } -sal_uInt16 SdrCustomShapeGeometryItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/ ) const -{ - return 1; -} bool SdrCustomShapeGeometryItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const { rVal <<= aPropSeq; return true; } + bool SdrCustomShapeGeometryItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) { if ( ! ( rVal >>= aPropSeq ) ) diff --git a/svx/source/items/e3ditem.cxx b/svx/source/items/e3ditem.cxx index 86f749c6eaab..1c83aa408f33 100644 --- a/svx/source/items/e3ditem.cxx +++ b/svx/source/items/e3ditem.cxx @@ -94,11 +94,6 @@ bool SvxB3DVectorItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) } -sal_uInt16 SvxB3DVectorItem::GetVersion (sal_uInt16 nFileFormatVersion) const -{ - return (nFileFormatVersion == SOFFICE_FILEFORMAT_31) ? USHRT_MAX : 0; -} - void SvxB3DVectorItem::dumpAsXml(xmlTextWriterPtr pWriter) const { xmlTextWriterStartElement(pWriter, BAD_CAST("SvxB3DVectorItem")); diff --git a/svx/source/items/legacyitem.cxx b/svx/source/items/legacyitem.cxx new file mode 100755 index 000000000000..005f97d2d95b --- /dev/null +++ b/svx/source/items/legacyitem.cxx @@ -0,0 +1,105 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <svx/legacyitem.hxx> +#include <tools/stream.hxx> +#include <svx/algitem.hxx> +#include <svx/rotmodit.hxx> + +namespace legacy +{ + namespace SvxOrientation + { + sal_uInt16 GetVersion(sal_uInt16) + { + return 0; + } + + void Create(SvxOrientationItem& rItem, SvStream& rStrm, sal_uInt16) + { + sal_uInt16 nVal(0); + rStrm.ReadUInt16( nVal ); + rItem.SetValue(static_cast<::SvxCellOrientation>(nVal)); + } + + SvStream& Store(const SvxOrientationItem& rItem, SvStream& rStrm, sal_uInt16) + { + rStrm.WriteUInt16( static_cast<sal_uInt16>(rItem.GetValue()) ); + return rStrm; + } + } + + namespace SvxMargin + { + sal_uInt16 GetVersion(sal_uInt16) + { + return 0; + } + + void Create(SvxMarginItem& rItem, SvStream& rStrm, sal_uInt16) + { + sal_Int16 nLeft(0); + sal_Int16 nTop(0); + sal_Int16 nRight(0); + sal_Int16 nBottom(0); + + rStrm.ReadInt16( nLeft ); + rStrm.ReadInt16( nTop ); + rStrm.ReadInt16( nRight ); + rStrm.ReadInt16( nBottom ); + + rItem.SetLeftMargin(nLeft); + rItem.SetTopMargin(nTop); + rItem.SetRightMargin(nRight); + rItem.SetBottomMargin(nBottom); + } + + SvStream& Store(const SvxMarginItem& rItem, SvStream& rStrm, sal_uInt16) + { + rStrm.WriteInt16( rItem.GetLeftMargin() ); + rStrm.WriteInt16( rItem.GetTopMargin() ); + rStrm.WriteInt16( rItem.GetRightMargin() ); + rStrm.WriteInt16( rItem.GetBottomMargin() ); + return rStrm; + } + } + + namespace SvxRotateMode + { + sal_uInt16 GetVersion(sal_uInt16) + { + return 0; + } + + void Create(SvxRotateModeItem& rItem, SvStream& rStrm, sal_uInt16) + { + sal_uInt16 nVal(0); + rStrm.ReadUInt16( nVal ); + rItem.SetValue(static_cast<::SvxRotateMode>(nVal)); + } + + SvStream& Store(const SvxRotateModeItem& rItem, SvStream& rStrm, sal_uInt16) + { + rStrm.WriteUInt16( static_cast<sal_uInt16>(rItem.GetValue()) ); + return rStrm; + } + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/items/rotmodit.cxx b/svx/source/items/rotmodit.cxx index bf147b2aa2d6..274a01d46160 100644 --- a/svx/source/items/rotmodit.cxx +++ b/svx/source/items/rotmodit.cxx @@ -56,13 +56,6 @@ SvxRotateModeItem::~SvxRotateModeItem() { } -SfxPoolItem* SvxRotateModeItem::Create( SvStream& rStream, sal_uInt16 ) const -{ - sal_uInt16 nVal; - rStream.ReadUInt16( nVal ); - return new SvxRotateModeItem( static_cast<SvxRotateMode>(nVal),Which() ); -} - bool SvxRotateModeItem::GetPresentation( SfxItemPresentation ePres, MapUnit /*eCoreUnit*/, MapUnit /*ePresUnit*/, @@ -96,11 +89,6 @@ SfxPoolItem* SvxRotateModeItem::Clone( SfxItemPool* ) const return new SvxRotateModeItem( *this ); } -sal_uInt16 SvxRotateModeItem::GetVersion( sal_uInt16 /*nFileVersion*/ ) const -{ - return 0; -} - bool SvxRotateModeItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const { sal_Int32 nUno = table::CellVertJustify2::STANDARD; diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx index c99b7e2ce467..5223c72e6889 100644 --- a/svx/source/svdraw/svdattr.cxx +++ b/svx/source/svdraw/svdattr.cxx @@ -1335,10 +1335,7 @@ SfxPoolItem* SdrTextFixedCellHeightItem::Clone( SfxItemPool * /*pPool*/) const { return new SdrTextFixedCellHeightItem( GetValue() ); } -sal_uInt16 SdrTextFixedCellHeightItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/) const -{ - return 1; -} + bool SdrTextFixedCellHeightItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const { bool bValue = GetValue(); @@ -1938,11 +1935,6 @@ SfxPoolItem* SdrGrafCropItem::Clone( SfxItemPool* /*pPool*/) const return new SdrGrafCropItem( *this ); } -sal_uInt16 SdrGrafCropItem::GetVersion( sal_uInt16 /*nFileVersion*/) const -{ - // GRFCROP_VERSION_MOVETOSVX is 1 - return GRFCROP_VERSION_MOVETOSVX; -} SdrTextAniStartInsideItem::~SdrTextAniStartInsideItem() { } diff --git a/svx/source/unodraw/unobrushitemhelper.cxx b/svx/source/unodraw/unobrushitemhelper.cxx index 7f8738d0f6ba..d465036d1edf 100644 --- a/svx/source/unodraw/unobrushitemhelper.cxx +++ b/svx/source/unodraw/unobrushitemhelper.cxx @@ -172,7 +172,7 @@ static sal_uInt16 getTransparenceForSvxBrushItem(const SfxItemSet& rSourceSet, b return nFillTransparence; } -static SvxBrushItem getSvxBrushItemForSolid(const SfxItemSet& rSourceSet, bool bSearchInParents, sal_uInt16 nBackgroundID) +static std::shared_ptr<SvxBrushItem> getSvxBrushItemForSolid(const SfxItemSet& rSourceSet, bool bSearchInParents, sal_uInt16 nBackgroundID) { Color aFillColor(rSourceSet.Get(XATTR_FILLCOLOR, bSearchInParents).GetColorValue()); @@ -189,10 +189,10 @@ static SvxBrushItem getSvxBrushItemForSolid(const SfxItemSet& rSourceSet, bool b aFillColor.SetTransparency(aTargetTrans); } - return SvxBrushItem(aFillColor, nBackgroundID); + return std::shared_ptr<SvxBrushItem>(new SvxBrushItem(aFillColor, nBackgroundID)); } -SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_uInt16 nBackgroundID, bool bSearchInParents, bool bXMLImportHack) +std::shared_ptr<SvxBrushItem> getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_uInt16 nBackgroundID, bool bSearchInParents, bool bXMLImportHack) { const XFillStyleItem* pXFillStyleItem(rSourceSet.GetItem<XFillStyleItem>(XATTR_FILLSTYLE, bSearchInParents)); @@ -207,10 +207,10 @@ SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_uInt aFillColor.SetTransparency(0xff); - return SvxBrushItem(aFillColor, nBackgroundID); + return std::shared_ptr<SvxBrushItem>(new SvxBrushItem(aFillColor, nBackgroundID)); } - SvxBrushItem aRetval(nBackgroundID); + std::shared_ptr<SvxBrushItem> aRetval(new SvxBrushItem(nBackgroundID)); switch(pXFillStyleItem->GetValue()) { @@ -249,7 +249,7 @@ SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_uInt aMixedColor.SetTransparency(aTargetTrans); } - aRetval = SvxBrushItem(aMixedColor, nBackgroundID); + aRetval = std::shared_ptr<SvxBrushItem>(new SvxBrushItem(aMixedColor, nBackgroundID)); break; } case drawing::FillStyle_HATCH: @@ -281,7 +281,7 @@ SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_uInt const sal_uInt8 aTargetTrans(std::min(sal_uInt8(0xfe), static_cast< sal_uInt8 >((nFillTransparence * 254) / 100))); aHatchColor.SetTransparency(aTargetTrans); - aRetval = SvxBrushItem(aHatchColor, nBackgroundID); + aRetval = std::shared_ptr<SvxBrushItem>(new SvxBrushItem(aHatchColor, nBackgroundID)); } break; @@ -324,7 +324,7 @@ SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_uInt } // create with given graphic and position - aRetval = SvxBrushItem(aGraphic, aSvxGraphicPosition, nBackgroundID); + aRetval = std::shared_ptr<SvxBrushItem>(new SvxBrushItem(aGraphic, aSvxGraphicPosition, nBackgroundID)); // get evtl. mixed transparence const sal_uInt16 nFillTransparence(getTransparenceForSvxBrushItem(rSourceSet, bSearchInParents)); @@ -332,7 +332,7 @@ SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_uInt if(0 != nFillTransparence) { // #i125189# nFillTransparence is in range [0..100] and needs to be in [0..100] signed - aRetval.setGraphicTransparency(static_cast< sal_Int8 >(nFillTransparence)); + aRetval->setGraphicTransparency(static_cast< sal_Int8 >(nFillTransparence)); } break; diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index 0830a9055f11..db10ce427596 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -1870,11 +1870,6 @@ SfxPoolItem* XSecondaryFillColorItem::Clone(SfxItemPool* /*pPool*/) const return new XSecondaryFillColorItem(*this); } -sal_uInt16 XSecondaryFillColorItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/ ) const -{ - return 2; -} - bool XSecondaryFillColorItem::GetPresentation ( SfxItemPresentation /*ePres*/, @@ -1982,14 +1977,6 @@ const XGradient& XFillGradientItem::GetGradientValue() const // GetValue -> GetG return aGradient; } -sal_uInt16 XFillGradientItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/) const -{ - // !!! this version number also represents the version number of superclasses - // !!! (e.g. XFillFloatTransparenceItem); if you make any changes here, - // !!! the superclass is also affected - return 1; -} - bool XFillGradientItem::GetPresentation ( SfxItemPresentation /*ePres*/, @@ -2283,13 +2270,6 @@ SfxPoolItem* XFillFloatTransparenceItem::Clone( SfxItemPool* /*pPool*/) const return new XFillFloatTransparenceItem( *this ); } -sal_uInt16 XFillFloatTransparenceItem::GetVersion( sal_uInt16 nFileFormatVersion ) const -{ - // !!! if version number of this object must be increased, please !!! - // !!! increase version number of base class XFillGradientItem !!! - return XFillGradientItem::GetVersion( nFileFormatVersion ); -} - bool XFillFloatTransparenceItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const { return XFillGradientItem::QueryValue( rVal, nMemberId ); diff --git a/svx/source/xoutdev/xattr2.cxx b/svx/source/xoutdev/xattr2.cxx index 54fad1415071..2469c66981b7 100644 --- a/svx/source/xoutdev/xattr2.cxx +++ b/svx/source/xoutdev/xattr2.cxx @@ -78,11 +78,6 @@ XLineJointItem::XLineJointItem( css::drawing::LineJoint eLineJoint ) : { } -sal_uInt16 XLineJointItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/) const -{ - return 1; -} - SfxPoolItem* XLineJointItem::Clone(SfxItemPool* /*pPool*/) const { return new XLineJointItem( *this ); @@ -240,11 +235,6 @@ XLineCapItem::XLineCapItem(css::drawing::LineCap eLineCap) { } -sal_uInt16 XLineCapItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/) const -{ - return 1; -} - SfxPoolItem* XLineCapItem::Clone(SfxItemPool* /*pPool*/) const { return new XLineCapItem( *this ); diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx index 9a2d47d631ff..a7b204217638 100644 --- a/svx/source/xoutdev/xattrbmp.cxx +++ b/svx/source/xoutdev/xattrbmp.cxx @@ -167,11 +167,6 @@ bool XFillBitmapItem::isPattern() const return vcl::bitmap::isHistorical8x8(GetGraphicObject().GetGraphic().GetBitmapEx(), aBack, aFront); } -sal_uInt16 XFillBitmapItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const -{ - return 2; -} - bool XFillBitmapItem::GetPresentation( SfxItemPresentation /*ePres*/, MapUnit /*eCoreUnit*/, diff --git a/sw/CppunitTest_sw_uiwriter.mk b/sw/CppunitTest_sw_uiwriter.mk index eaf0b0d15a17..e6867b790b9d 100644 --- a/sw/CppunitTest_sw_uiwriter.mk +++ b/sw/CppunitTest_sw_uiwriter.mk @@ -36,6 +36,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_uiwriter, \ vcl \ tl \ utl \ + svx \ )) $(eval $(call gb_CppunitTest_use_externals,sw_uiwriter,\ diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index 9f92d20e643f..ededa54c689b 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -326,6 +326,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\ sw/source/core/layout/layact \ sw/source/core/layout/laycache \ sw/source/core/layout/layouter \ + sw/source/core/layout/legacyitem \ sw/source/core/layout/movedfwdfrmsbyobjpos \ sw/source/core/layout/newfrm \ sw/source/core/layout/objectformatter \ diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 9bba13ef17be..fd8ab6c58fdd 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -1474,7 +1474,7 @@ public: /// Call again without bOptimize to ensure equal height in case some row's content didn't fit. bool BalanceRowHeight( const SwCursor& rCursor, bool bTstOnly, const bool bOptimize ); void SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew ); - static bool GetRowBackground( const SwCursor& rCursor, SvxBrushItem &rToFill ); + static bool GetRowBackground( const SwCursor& rCursor, std::shared_ptr<SvxBrushItem>& rToFill ); void SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ); void SetTabLineStyle( const SwCursor& rCursor, const Color* pColor, bool bSetLine, @@ -1491,7 +1491,7 @@ public: the values of the same property over any other boxes in the selection; if any value is different from that of the first box, the property is unset (and false is returned). */ - static bool GetBoxAttr( const SwCursor& rCursor, SfxPoolItem &rToFill ); + static bool GetBoxAttr( const SwCursor& rCursor, std::shared_ptr<SfxPoolItem>& rToFill ); void SetBoxAlign( const SwCursor& rCursor, sal_uInt16 nAlign ); static sal_uInt16 GetBoxAlign( const SwCursor& rCursor ); /// Adjusts selected cell widths in such a way, that their content does not need to be wrapped (if possible). diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx index 886cb2d7bf39..4d619d4d65f0 100644 --- a/sw/inc/fesh.hxx +++ b/sw/inc/fesh.hxx @@ -665,16 +665,16 @@ public: void SetTabLineStyle(const Color* pColor, bool bSetLine = false, const editeng::SvxBorderLine* pBorderLine = nullptr); void SetTabBackground( const SvxBrushItem &rNew ); - void GetTabBackground( SvxBrushItem &rToFill ) const; + void GetTabBackground( std::shared_ptr<SvxBrushItem>& rToFill ) const; void SetBoxBackground( const SvxBrushItem &rNew ); - bool GetBoxBackground( SvxBrushItem &rToFill ) const; ///< FALSE ambiguous. + bool GetBoxBackground( std::shared_ptr<SvxBrushItem>& rToFill ) const; ///< FALSE ambiguous. void SetBoxDirection( const SvxFrameDirectionItem& rNew ); - bool GetBoxDirection( SvxFrameDirectionItem& rToFill ) const; ///< FALSE ambiguous. + bool GetBoxDirection( std::shared_ptr<SvxFrameDirectionItem>& rToFill ) const; ///< FALSE ambiguous. void SetRowBackground( const SvxBrushItem &rNew ); - bool GetRowBackground( SvxBrushItem &rToFill ) const; ///< FALSE ambiguous. + bool GetRowBackground( std::shared_ptr<SvxBrushItem>& rToFill ) const; ///< FALSE ambiguous. SwTab WhichMouseTabCol( const Point &rPt ) const; void GetTabCols( SwTabCols &rToFill ) const; ///< Info about columns and margins. diff --git a/sw/inc/fmtornt.hxx b/sw/inc/fmtornt.hxx index 055db32bade3..24ffdc907e26 100644 --- a/sw/inc/fmtornt.hxx +++ b/sw/inc/fmtornt.hxx @@ -38,7 +38,6 @@ class SW_DLLPUBLIC SwFormatVertOrient: public SfxPoolItem public: SwFormatVertOrient( SwTwips nY = 0, sal_Int16 eVert = css::text::VertOrientation::NONE, sal_Int16 eRel = css::text::RelOrientation::PRINT_AREA ); - inline SwFormatVertOrient &operator=( const SwFormatVertOrient &rCpy ); SwFormatVertOrient(SwFormatVertOrient const &) = default; // SfxPoolItem copy function dichotomy /// "Pure virtual methods" of SfxPoolItem. @@ -52,9 +51,6 @@ public: virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; - SvStream& Store(SvStream &rStream, sal_uInt16 itemVersion) const override; - SfxPoolItem* Create(SvStream &rStream, sal_uInt16 itemVersion) const override; - sal_Int16 GetVertOrient() const { return m_eOrient; } sal_Int16 GetRelationOrient() const { return m_eRelation; } void SetVertOrient( sal_Int16 eNew ) { m_eOrient = eNew; } @@ -75,7 +71,6 @@ class SW_DLLPUBLIC SwFormatHoriOrient: public SfxPoolItem public: SwFormatHoriOrient( SwTwips nX = 0, sal_Int16 eHori = css::text::HoriOrientation::NONE, sal_Int16 eRel = css::text::RelOrientation::PRINT_AREA, bool bPos = false ); - inline SwFormatHoriOrient &operator=( const SwFormatHoriOrient &rCpy ); SwFormatHoriOrient(SwFormatHoriOrient const &) = default; // SfxPoolItem copy function dichotomy /// "Pure virtual methods" of SfxPoolItem. @@ -103,22 +98,6 @@ public: void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; -inline SwFormatVertOrient &SwFormatVertOrient::operator=( const SwFormatVertOrient &rCpy ) -{ - m_nYPos = rCpy.GetPos(); - m_eOrient = rCpy.GetVertOrient(); - m_eRelation = rCpy.GetRelationOrient(); - return *this; -} -inline SwFormatHoriOrient &SwFormatHoriOrient::operator=( const SwFormatHoriOrient &rCpy ) -{ - m_nXPos = rCpy.GetPos(); - m_eOrient = rCpy.GetHoriOrient(); - m_eRelation = rCpy.GetRelationOrient(); - m_bPosToggle = rCpy.IsPosToggle(); - return *this; -} - inline const SwFormatVertOrient &SwAttrSet::GetVertOrient(bool bInP) const { return Get( RES_VERT_ORIENT,bInP); } inline const SwFormatHoriOrient &SwAttrSet::GetHoriOrient(bool bInP) const diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx index cbeda7237f66..849b14d8b688 100644 --- a/sw/inc/format.hxx +++ b/sw/inc/format.hxx @@ -96,7 +96,7 @@ public: } SfxItemState GetItemState( sal_uInt16 nWhich, bool bSrchInParent = true, const SfxPoolItem **ppItem = nullptr ) const; - SfxItemState GetBackgroundState(SvxBrushItem &rItem) const; + SfxItemState GetBackgroundState(std::shared_ptr<SvxBrushItem>& rItem) const; virtual bool SetFormatAttr( const SfxPoolItem& rAttr ); virtual bool SetFormatAttr( const SfxItemSet& rSet ); virtual bool ResetFormatAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 = 0 ); @@ -203,7 +203,7 @@ public: inline const SvxFormatKeepItem &GetKeep( bool = true ) const; // Create SvxBrushItem for Background fill (partially for backwards compatibility) - SvxBrushItem makeBackgroundBrushItem( bool = true ) const; + std::shared_ptr<SvxBrushItem> makeBackgroundBrushItem( bool = true ) const; inline const SvxShadowItem &GetShadow( bool = true ) const; inline const SwFormatPageDesc &GetPageDesc( bool = true ) const; diff --git a/sw/inc/legacyitem.hxx b/sw/inc/legacyitem.hxx new file mode 100755 index 000000000000..6df864b9de58 --- /dev/null +++ b/sw/inc/legacyitem.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_SW_LEGACYITEM_HXX +#define INCLUDED_SW_LEGACYITEM_HXX + +#include "swdllapi.h" + +////////////////////////////////////////////////////////////////////////////// +// // sw +// SwFormatVertOrient m_aVerticalAlignment; +////////////////////////////////////////////////////////////////////////////// + +class SvStream; +class SwFormatVertOrient; + +namespace legacy +{ + namespace SwFormatVert + { + sal_uInt16 SW_DLLPUBLIC GetVersion(sal_uInt16 nFileFormatVersion); + void SW_DLLPUBLIC Create(SwFormatVertOrient& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + SW_DLLPUBLIC SvStream& Store(const SwFormatVertOrient& rItem, SvStream& rStrm, sal_uInt16 nItemVersion); + } +} + +#endif // INCLUDED_SW_LEGACYITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index b8efd5b985af..debe937dd0bf 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -486,7 +486,7 @@ public: SwTwips GetAdditionalIndentForStartingNewList() const; - void ClearLRSpaceItemDueToListLevelIndents( SvxLRSpaceItem& o_rLRSpaceItem ) const; + void ClearLRSpaceItemDueToListLevelIndents( std::shared_ptr<SvxLRSpaceItem>& o_rLRSpaceItem ) const; /** return left margin for tab stop position calculation diff --git a/sw/inc/paratr.hxx b/sw/inc/paratr.hxx index 78c03ff0e2df..a66ec00beebd 100644 --- a/sw/inc/paratr.hxx +++ b/sw/inc/paratr.hxx @@ -138,8 +138,6 @@ public: SwNumRuleItem( const OUString& rRuleName ) : SfxStringItem( RES_PARATR_NUMRULE, rRuleName ) {} - SwNumRuleItem& operator=( const SwNumRuleItem& rCpy ) - { SetValue( rCpy.GetValue() ); return *this; } SwNumRuleItem(SwNumRuleItem const &) = default; // SfxPoolItem copy function dichotomy /// "pure virtual methods" of SfxPoolItem diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx index 2170091abe5d..8b0320f9f929 100644 --- a/sw/inc/tblafmt.hxx +++ b/sw/inc/tblafmt.hxx @@ -49,6 +49,7 @@ #include <editeng/frmdiritem.hxx> #include <editeng/shaditem.hxx> #include <svx/rotmodit.hxx> +#include <svx/autoformathelper.hxx> #include <svl/intitem.hxx> #include <editeng/lineitem.hxx> #include "fmtpdsc.hxx" @@ -60,125 +61,49 @@ struct SwAfVersions; class SvNumberFormatter; class SwTable; -class SwBoxAutoFormat +class SwBoxAutoFormat : public AutoFormatBase { - // common attributes of Calc and Writer - // --- from 641 on: CJK and CTL font settings - SvxFontItem m_aFont; - SvxFontHeightItem m_aHeight; - SvxWeightItem m_aWeight; - SvxPostureItem m_aPosture; - - SvxFontItem m_aCJKFont; - SvxFontHeightItem m_aCJKHeight; - SvxWeightItem m_aCJKWeight; - SvxPostureItem m_aCJKPosture; - - SvxFontItem m_aCTLFont; - SvxFontHeightItem m_aCTLHeight; - SvxWeightItem m_aCTLWeight; - SvxPostureItem m_aCTLPosture; - - SvxUnderlineItem m_aUnderline; - SvxOverlineItem m_aOverline; - SvxCrossedOutItem m_aCrossedOut; - SvxContourItem m_aContour; - SvxShadowedItem m_aShadowed; - SvxColorItem m_aColor; - SvxBoxItem m_aBox; - SvxLineItem m_aTLBR; - SvxLineItem m_aBLTR; - SvxBrushItem m_aBackground; - // Writer specific - SvxAdjustItem m_aAdjust; - SvxFrameDirectionItem m_aTextOrientation; - SwFormatVertOrient m_aVerticalAlignment; - - // Calc specific - SvxHorJustifyItem m_aHorJustify; - SvxVerJustifyItem m_aVerJustify; - SfxBoolItem m_aStacked; - SvxMarginItem m_aMargin; - SfxBoolItem m_aLinebreak; - SfxInt32Item m_aRotateAngle; - SvxRotateModeItem m_aRotateMode; + std::shared_ptr<SvxFrameDirectionItem> m_aTextOrientation; + std::shared_ptr<SwFormatVertOrient> m_aVerticalAlignment; // number format - OUString m_sNumFormatString; - LanguageType m_eSysLanguage, m_eNumFormatLanguage; + OUString m_sNumFormatString; + LanguageType m_eSysLanguage; + LanguageType m_eNumFormatLanguage; css::uno::WeakReference<css::uno::XInterface> m_wXObject; - friend class SwDocTest; public: SwBoxAutoFormat(); SwBoxAutoFormat( const SwBoxAutoFormat& rNew ); ~SwBoxAutoFormat(); - SwBoxAutoFormat& operator=( const SwBoxAutoFormat& rNew ); /// Comparing based of boxes backgrounds. bool operator==(const SwBoxAutoFormat& rRight); // The get-methods. - const SvxFontItem &GetFont() const { return m_aFont; } - const SvxFontHeightItem &GetHeight() const { return m_aHeight; } - const SvxWeightItem &GetWeight() const { return m_aWeight; } - const SvxPostureItem &GetPosture() const { return m_aPosture; } - const SvxFontItem &GetCJKFont() const { return m_aCJKFont; } - const SvxFontHeightItem &GetCJKHeight() const { return m_aCJKHeight; } - const SvxWeightItem &GetCJKWeight() const { return m_aCJKWeight; } - const SvxPostureItem &GetCJKPosture() const { return m_aCJKPosture; } - const SvxFontItem &GetCTLFont() const { return m_aCTLFont; } - const SvxFontHeightItem &GetCTLHeight() const { return m_aCTLHeight; } - const SvxWeightItem &GetCTLWeight() const { return m_aCTLWeight; } - const SvxPostureItem &GetCTLPosture() const { return m_aCTLPosture; } - const SvxUnderlineItem &GetUnderline() const { return m_aUnderline; } - const SvxOverlineItem &GetOverline() const { return m_aOverline; } - const SvxCrossedOutItem &GetCrossedOut() const { return m_aCrossedOut; } - const SvxContourItem &GetContour() const { return m_aContour; } - const SvxShadowedItem &GetShadowed() const { return m_aShadowed; } - const SvxColorItem &GetColor() const { return m_aColor; } - const SvxAdjustItem &GetAdjust() const { return m_aAdjust; } - const SvxFrameDirectionItem& GetTextOrientation() const { return m_aTextOrientation; } - const SwFormatVertOrient& GetVerticalAlignment() const { return m_aVerticalAlignment; } - const SvxBoxItem &GetBox() const { return m_aBox; } - const SvxBrushItem &GetBackground() const { return m_aBackground; } + const SvxFrameDirectionItem& GetTextOrientation() const { return *m_aTextOrientation; } + const SwFormatVertOrient& GetVerticalAlignment() const { return *m_aVerticalAlignment; } + void GetValueFormat( OUString& rFormat, LanguageType& rLng, LanguageType& rSys ) const { rFormat = m_sNumFormatString; rLng = m_eNumFormatLanguage; rSys = m_eSysLanguage; } + const OUString& GetNumFormatString() const { return m_sNumFormatString; } + const LanguageType& GetSysLanguage() const { return m_eSysLanguage; } + const LanguageType& GetNumFormatLanguage() const { return m_eNumFormatLanguage; } + // The set-methods. - void SetFont( const SvxFontItem& rNew ) { m_aFont = rNew; } - void SetHeight( const SvxFontHeightItem& rNew ) { m_aHeight = rNew; } - void SetWeight( const SvxWeightItem& rNew ) { m_aWeight = rNew; } - void SetPosture( const SvxPostureItem& rNew ) { m_aPosture = rNew; } - void SetCJKFont( const SvxFontItem& rNew ) { m_aCJKFont = rNew; } - void SetCJKHeight( const SvxFontHeightItem& rNew ) { m_aCJKHeight = rNew; } - void SetCJKWeight( const SvxWeightItem& rNew ) { m_aCJKWeight = rNew; } - void SetCJKPosture( const SvxPostureItem& rNew ) { m_aCJKPosture = rNew; } - void SetCTLFont( const SvxFontItem& rNew ) { m_aCTLFont = rNew; } - void SetCTLHeight( const SvxFontHeightItem& rNew ) { m_aCTLHeight = rNew; } - void SetCTLWeight( const SvxWeightItem& rNew ) { m_aCTLWeight = rNew; } - void SetCTLPosture( const SvxPostureItem& rNew ) { m_aCTLPosture = rNew; } - void SetUnderline( const SvxUnderlineItem& rNew ) { m_aUnderline = rNew; } - void SetOverline( const SvxOverlineItem& rNew ) { m_aOverline = rNew; } - void SetCrossedOut( const SvxCrossedOutItem& rNew ) { m_aCrossedOut = rNew; } - void SetContour( const SvxContourItem& rNew ) { m_aContour = rNew; } - void SetShadowed( const SvxShadowedItem& rNew ) { m_aShadowed = rNew; } - void SetColor( const SvxColorItem& rNew ) { m_aColor = rNew; } - void SetAdjust( const SvxAdjustItem& rNew ) - { - m_aAdjust.SetAdjust( rNew.GetAdjust() ); - m_aAdjust.SetOneWord( rNew.GetOneWord() ); - m_aAdjust.SetLastBlock( rNew.GetLastBlock() ); - } - void SetTextOrientation(const SvxFrameDirectionItem& rNew) { m_aTextOrientation = rNew; } - void SetVerticalAlignment(const SwFormatVertOrient& rNew) { m_aVerticalAlignment = rNew; } - void SetBox( const SvxBoxItem& rNew ) { m_aBox = rNew; } - void SetBackground( const SvxBrushItem& rNew ) { m_aBackground = rNew; } + void SetTextOrientation( const SvxFrameDirectionItem& rNew ) { m_aTextOrientation.reset(static_cast<SvxFrameDirectionItem*>(rNew.Clone())); } + void SetVerticalAlignment( const SwFormatVertOrient& rNew ) { m_aVerticalAlignment.reset(static_cast<SwFormatVertOrient*>(rNew.Clone())); } + void SetValueFormat( const OUString& rFormat, LanguageType eLng, LanguageType eSys ) { m_sNumFormatString = rFormat; m_eNumFormatLanguage = eLng; m_eSysLanguage = eSys; } + void SetNumFormatString(const OUString& rNew) { m_sNumFormatString = rNew; } + void SetSysLanguage(const LanguageType& rNew) { m_eSysLanguage = rNew; } + void SetNumFormatLanguage(const LanguageType& rNew) { m_eNumFormatLanguage = rNew; } + css::uno::WeakReference<css::uno::XInterface> const& GetXObject() const { return m_wXObject; } void SetXObject(css::uno::Reference<css::uno::XInterface> const& xObject) @@ -186,7 +111,6 @@ public: bool Load( SvStream& rStream, const SwAfVersions& rVersions, sal_uInt16 nVer ); bool Save( SvStream& rStream, sal_uInt16 fileVersion ) const; - void SaveVersionNo( SvStream& rStream, sal_uInt16 fileVersion ) const; }; enum class SwTableAutoFormatUpdateFlags { Char = 1, Box = 2 }; @@ -262,14 +186,14 @@ class SW_DLLPUBLIC SwTableAutoFormat SwBoxAutoFormat* m_aBoxAutoFormat[ 16 ]; // Writer-specific options - SvxFormatBreakItem m_aBreak; + std::shared_ptr<SvxFormatBreakItem> m_aBreak; SwFormatPageDesc m_aPageDesc; - SvxFormatKeepItem m_aKeepWithNextPara; + std::shared_ptr<SvxFormatKeepItem> m_aKeepWithNextPara; sal_uInt16 m_aRepeatHeading; bool m_bLayoutSplit; bool m_bRowSplit; bool m_bCollapsingBorders; - SvxShadowItem m_aShadow; + std::shared_ptr<SvxShadowItem> m_aShadow; bool m_bHidden; bool m_bUserDefined; @@ -280,6 +204,14 @@ public: SwTableAutoFormat& operator=( const SwTableAutoFormat& rNew ); + const SvxFormatBreakItem& GetBreak() const { return *m_aBreak; } + const SvxFormatKeepItem& GetKeepWithNextPara() const { return *m_aKeepWithNextPara; } + const SvxShadowItem& GetShadow() const { return *m_aShadow; } + + void SetBreak(const SvxFormatBreakItem& rNew) { m_aBreak.reset(static_cast<SvxFormatBreakItem*>(rNew.Clone())); } + void SetKeepWithNextPara(const SvxFormatKeepItem& rNew) { m_aKeepWithNextPara.reset(static_cast<SvxFormatKeepItem*>(rNew.Clone())); } + void SetShadow(const SvxShadowItem& rNew) { m_aShadow.reset(static_cast<SvxShadowItem*>(rNew.Clone())); } + void SetBoxFormat( const SwBoxAutoFormat& rNew, sal_uInt8 nPos ); const SwBoxAutoFormat& GetBoxFormat( sal_uInt8 nPos ) const; SwBoxAutoFormat& GetBoxFormat( sal_uInt8 nPos ); diff --git a/sw/qa/core/filters-test.cxx b/sw/qa/core/filters-test.cxx index bf265b15388f..67db9346e52e 100644 --- a/sw/qa/core/filters-test.cxx +++ b/sw/qa/core/filters-test.cxx @@ -99,7 +99,7 @@ bool SwFiltersTest::filter(const OUString &rFilter, const OUString &rURL, if (rUserData == FILTER_TEXT_DLG) { pSrcMed->GetItemSet()->Put( - SfxStringItem(SID_FILE_FILTEROPTIONS, OUString("UTF8,LF,Liberation Mono,en-US"))); + SfxStringItem(SID_FILE_FILTEROPTIONS, "UTF8,LF,Liberation Mono,en-US")); } bool bLoaded = xDocShRef->DoLoad(pSrcMed); diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index 0540212e2140..20ac02c6a3b0 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -1279,49 +1279,47 @@ void SwDocTest::testTableAutoFormats() SvxBrushItem aBackground( Color(0xFF11FF), RES_BACKGROUND ); aBoxAF.SetBackground( aBackground ); //Set m_aTLBR - aBoxAF.m_aTLBR.ScaleMetrics( 11,12 ); - SvxLineItem aTLBRLine = aBoxAF.m_aTLBR; + SvxLineItem aTLBRLine(0); aTLBRLine.ScaleMetrics( 11,12 ); + aBoxAF.SetTLBR(aTLBRLine); //Set m_aBLTR - aBoxAF.m_aBLTR.ScaleMetrics( 13,14 ); - SvxLineItem aBLTRLine = aBoxAF.m_aBLTR; + SvxLineItem aBLTRLine(0); aBLTRLine.ScaleMetrics( 13,14 ); + aBoxAF.SetBLTR(aBLTRLine); //Set m_aHorJustify SvxHorJustifyItem aHJustify( SvxCellHorJustify::Center, 0 ); - aBoxAF.m_aHorJustify = aHJustify; + aBoxAF.SetHorJustify(aHJustify); //Set m_aVerJustify SvxVerJustifyItem aVJustify( SvxCellVerJustify::Center , 0 ); - aBoxAF.m_aVerJustify = aVJustify; + aBoxAF.SetVerJustify(aVJustify); //Set m_aStacked - aBoxAF.m_aStacked.SetValue( true ); - SfxBoolItem aStacked = aBoxAF.m_aStacked; + SfxBoolItem aStacked(0, true); + aBoxAF.SetStacked(aStacked); //Set m_aMargin - aBoxAF.m_aMargin.SetLeftMargin( sal_Int16(4) ); - aBoxAF.m_aMargin.SetRightMargin( sal_Int16(3) ); - aBoxAF.m_aMargin.SetTopMargin( sal_Int16(2) ); - aBoxAF.m_aMargin.SetBottomMargin( sal_Int16(3) ); - SvxMarginItem aMargin = aBoxAF.m_aMargin; + SvxMarginItem aSvxMarginItem(sal_Int16(4), sal_Int16(2), sal_Int16(3), sal_Int16(3), 0); + aBoxAF.SetMargin(aSvxMarginItem); //Set m_aLinebreak - aBoxAF.m_aLinebreak.SetValue( true ); - SfxBoolItem aLBreak = aBoxAF.m_aLinebreak; + SfxBoolItem aLBreak(0, true); + aBoxAF.SetLinebreak(aLBreak); //Set m_aRotateAngle - aBoxAF.m_aRotateAngle.SetValue( sal_Int32(5) ); - SfxInt32Item aRAngle = aBoxAF.m_aRotateAngle; + SfxInt32Item aRAngle(sal_Int32(5)); + aBoxAF.SetRotateAngle(aRAngle); //Set m_aRotateMode - aBoxAF.m_aRotateMode.SetValue( SVX_ROTATE_MODE_CENTER ); + SvxRotateModeItem aSvxRotateModeItem(SVX_ROTATE_MODE_CENTER, 0); + aBoxAF.SetRotateMode(aSvxRotateModeItem); //Set m_sNumFormatString OUString aNFString = "UnitTestFormat"; - aBoxAF.m_sNumFormatString = aNFString; + aBoxAF.SetNumFormatString(aNFString); //Set m_eSysLanguage LanguageType aSLang( LANGUAGE_ENGLISH_INDIA ); - aBoxAF.m_eSysLanguage = aSLang; + aBoxAF.SetSysLanguage(aSLang); //Set m_eNumFormatLanguage LanguageType aNFLang( LANGUAGE_GERMAN ); - aBoxAF.m_eNumFormatLanguage = aNFLang; + aBoxAF.SetNumFormatLanguage(aNFLang); //Set m_aBreak SvxFormatBreakItem aBreak( SvxBreak::PageBefore, 0 ); - aTableAF.m_aBreak = aBreak; + aTableAF.SetBreak(aBreak); //Set m_aKeepWithNextPara SvxFormatKeepItem aKWNPara( true, 0 ); - aTableAF.m_aKeepWithNextPara = aKWNPara; + aTableAF.SetKeepWithNextPara(aKWNPara); //Set m_aPageDesc SwFormatPageDesc aPDesc; uno::Any aPDAny( sal_uInt16(3) ); @@ -1341,7 +1339,7 @@ void SwDocTest::testTableAutoFormats() aTableAF.m_bCollapsingBorders = aCBorders; //Set m_aShadow SvxShadowItem aShadow( 0, nullptr, 103, SvxShadowLocation::BottomLeft ); - aTableAF.m_aShadow = aShadow; + aTableAF.SetShadow(aShadow); //Set bInclFont bool aIFont = false; aTableAF.m_bInclFont = aIFont; @@ -1434,21 +1432,21 @@ void SwDocTest::testTableAutoFormats() //GetBackground CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetBackground() == aBackground ) ); //Get m_aTLBR - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).m_aTLBR == aTLBRLine ) ); + CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetTLBR() == aTLBRLine ) ); //Get m_aBLTR - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).m_aBLTR == aBLTRLine ) ); + CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetBLTR() == aBLTRLine ) ); //Get m_aHorJustify - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).m_aHorJustify == aHJustify ) ); + CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetHorJustify() == aHJustify ) ); //Get m_aVerJustify - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).m_aVerJustify == aVJustify ) ); + CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetVerJustify() == aVJustify ) ); //Get m_aStacked - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).m_aStacked == aStacked ) ); + CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetStacked() == aStacked ) ); //Get m_aMargin - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).m_aMargin == aMargin ) ); + CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetMargin() == aSvxMarginItem ) ); //Get m_aLinebreak - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).m_aLinebreak == aLBreak ) ); + CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetLinebreak() == aLBreak ) ); //Get m_aRotateAngle - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).m_aRotateAngle == aRAngle ) ); + CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetRotateAngle() == aRAngle ) ); #if !((defined(__clang__) && __clang_major__ == 4 && __clang_minor__ == 0) \ || (defined __APPLE__ && defined __clang__ \ && defined __apple_build_version__ \ @@ -1456,19 +1454,19 @@ void SwDocTest::testTableAutoFormats() && __apple_build_version__ <= 9000099)) // Temporary fix for mysterious problem with Clang in F26 and Xcode 9 //Get m_aRotateMode - SvxRotateModeItem aRMode = aBoxAF.m_aRotateMode; - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).m_aRotateMode == aRMode ) ); + //SvxRotateModeItem aRMode = aBoxAF.m_aRotateMode;GetRotateMode + CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetRotateMode() == aSvxRotateModeItem ) ); #endif //Get m_sNumFormatString - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).m_sNumFormatString == aNFString ) ); + CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetNumFormatString() == aNFString ) ); //Get m_eSysLanguage - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).m_eSysLanguage == aSLang ) ); + CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetSysLanguage() == aSLang ) ); //Get m_eNumFormatLanguage - CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).m_eNumFormatLanguage == aNFLang ) ); + CPPUNIT_ASSERT( bool( pLoadAF->GetBoxFormat(0).GetNumFormatLanguage() == aNFLang ) ); //Get m_aBreak - CPPUNIT_ASSERT( bool( pLoadAF->m_aBreak == aBreak ) ); + CPPUNIT_ASSERT( bool( pLoadAF->GetBreak() == aBreak ) ); //Get m_aKeepWithNextPara - CPPUNIT_ASSERT( bool( pLoadAF->m_aKeepWithNextPara == aKWNPara ) ); + CPPUNIT_ASSERT( bool( pLoadAF->GetKeepWithNextPara() == aKWNPara ) ); //Get m_aPageDesc CPPUNIT_ASSERT( bool( pLoadAF->m_aPageDesc == aPDesc ) ); //Get m_aRepeatHeading @@ -1480,7 +1478,7 @@ void SwDocTest::testTableAutoFormats() //Get m_bCollapsingBorders CPPUNIT_ASSERT( bool( pLoadAF->m_bCollapsingBorders == aCBorders ) ); //Get m_aShadow - CPPUNIT_ASSERT( bool( pLoadAF->m_aShadow == aShadow ) ); + CPPUNIT_ASSERT( bool( pLoadAF->GetShadow() == aShadow ) ); //Get bInclFont CPPUNIT_ASSERT( bool( pLoadAF->m_bInclFont == aIFont ) ); //Get bInclJustify diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx index af0ebc16bc1c..300118c72abb 100644 --- a/sw/source/core/attr/format.cxx +++ b/sw/source/core/attr/format.cxx @@ -382,14 +382,14 @@ const SfxPoolItem& SwFormat::GetFormatAttr( sal_uInt16 nWhich, bool bInParents ) { // FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] SAL_INFO("sw.core", "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes or makeBackgroundBrushItem (simple fallback is in place and used)"); - static SvxBrushItem aSvxBrushItem(RES_BACKGROUND); + static std::shared_ptr<SvxBrushItem> aSvxBrushItem; //(std::make_shared<SvxBrushItem>(RES_BACKGROUND)); // fill the local static SvxBrushItem from the current ItemSet so that // the fill attributes [XATTR_FILL_FIRST .. XATTR_FILL_LAST] are used // as good as possible to create a fallback representation and return that aSvxBrushItem = getSvxBrushItemFromSourceSet(m_aSet, RES_BACKGROUND, bInParents); - return aSvxBrushItem; + return *aSvxBrushItem; } return m_aSet.Get( nWhich, bInParents ); @@ -409,12 +409,11 @@ SfxItemState SwFormat::GetItemState( sal_uInt16 nWhich, bool bSrchInParent, cons // if yes, fill the local SvxBrushItem using the new fill attributes // as good as possible to have an instance for the pointer to point // to and return as state that it is set - - static SvxBrushItem aSvxBrushItem(RES_BACKGROUND); + static std::shared_ptr<SvxBrushItem> aSvxBrushItem; //(RES_BACKGROUND); aSvxBrushItem = getSvxBrushItemFromSourceSet(m_aSet, RES_BACKGROUND, bSrchInParent); if( ppItem ) - *ppItem = &aSvxBrushItem; + *ppItem = aSvxBrushItem.get(); return SfxItemState::SET; } @@ -430,7 +429,7 @@ SfxItemState SwFormat::GetItemState( sal_uInt16 nWhich, bool bSrchInParent, cons return m_aSet.GetItemState( nWhich, bSrchInParent, ppItem ); } -SfxItemState SwFormat::GetBackgroundState(SvxBrushItem &rItem) const +SfxItemState SwFormat::GetBackgroundState(std::shared_ptr<SvxBrushItem>& rItem) const { if (supportsFullDrawingLayerFillAttributeSet()) { @@ -454,7 +453,7 @@ SfxItemState SwFormat::GetBackgroundState(SvxBrushItem &rItem) const const SfxPoolItem* pItem = nullptr; SfxItemState eRet = m_aSet.GetItemState(RES_BACKGROUND, true, &pItem); if (pItem) - rItem = *static_cast<const SvxBrushItem*>(pItem); + rItem.reset(static_cast<SvxBrushItem*>(pItem->Clone())); return eRet; } @@ -782,7 +781,7 @@ void SwFormat::SetGrabBagItem(const uno::Any& rVal) m_pGrabBagItem->PutValue(rVal, 0); } -SvxBrushItem SwFormat::makeBackgroundBrushItem(bool bInP) const +std::shared_ptr<SvxBrushItem> SwFormat::makeBackgroundBrushItem(bool bInP) const { if (supportsFullDrawingLayerFillAttributeSet()) { @@ -795,7 +794,7 @@ SvxBrushItem SwFormat::makeBackgroundBrushItem(bool bInP) const return getSvxBrushItemFromSourceSet(m_aSet, RES_BACKGROUND, bInP); } - return m_aSet.GetBackground(bInP); + return std::shared_ptr<SvxBrushItem>(static_cast<SvxBrushItem*>(m_aSet.GetBackground(bInP).Clone())); } drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwFormat::getSdrAllFillAttributesHelper() const diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index c6ff7c163462..1fe99be1dd2a 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -4306,9 +4306,9 @@ SwFlyFrameFormat* DocumentContentOperationsManager::InsNoTextNode( const SwPosit #define NUMRULE_STATE \ SfxItemState aNumRuleState = SfxItemState::UNKNOWN; \ - SwNumRuleItem aNumRuleItem; \ + std::shared_ptr<SwNumRuleItem> aNumRuleItem; \ SfxItemState aListIdState = SfxItemState::UNKNOWN; \ - SfxStringItem aListIdItem( RES_PARATR_LIST_ID, OUString() ); \ + std::shared_ptr<SfxStringItem> aListIdItem; \ #define PUSH_NUMRULE_STATE \ lcl_PushNumruleState( aNumRuleState, aNumRuleItem, aListIdState, aListIdItem, pDestTextNd ); @@ -4316,9 +4316,10 @@ SwFlyFrameFormat* DocumentContentOperationsManager::InsNoTextNode( const SwPosit #define POP_NUMRULE_STATE \ lcl_PopNumruleState( aNumRuleState, aNumRuleItem, aListIdState, aListIdItem, pDestTextNd, rPam ); -static void lcl_PushNumruleState( SfxItemState &aNumRuleState, SwNumRuleItem &aNumRuleItem, - SfxItemState &aListIdState, SfxStringItem &aListIdItem, - const SwTextNode *pDestTextNd ) +static void lcl_PushNumruleState( + SfxItemState &aNumRuleState, std::shared_ptr<SwNumRuleItem>& aNumRuleItem, + SfxItemState &aListIdState, std::shared_ptr<SfxStringItem>& aListIdItem, + const SwTextNode *pDestTextNd ) { // Safe numrule item at destination. // #i86492# - Safe also <ListId> item of destination. @@ -4328,20 +4329,22 @@ static void lcl_PushNumruleState( SfxItemState &aNumRuleState, SwNumRuleItem &aN const SfxPoolItem * pItem = nullptr; aNumRuleState = pAttrSet->GetItemState(RES_PARATR_NUMRULE, false, &pItem); if (SfxItemState::SET == aNumRuleState) - aNumRuleItem = *static_cast<const SwNumRuleItem *>( pItem); + { + aNumRuleItem.reset(static_cast<SwNumRuleItem*>(pItem->Clone())); + } - aListIdState = - pAttrSet->GetItemState(RES_PARATR_LIST_ID, false, &pItem); + aListIdState = pAttrSet->GetItemState(RES_PARATR_LIST_ID, false, &pItem); if (SfxItemState::SET == aListIdState) { - aListIdItem.SetValue( static_cast<const SfxStringItem*>(pItem)->GetValue() ); + aListIdItem.reset(static_cast<SfxStringItem*>(pItem->Clone())); } } } -static void lcl_PopNumruleState( SfxItemState aNumRuleState, const SwNumRuleItem &aNumRuleItem, - SfxItemState aListIdState, const SfxStringItem &aListIdItem, - SwTextNode *pDestTextNd, const SwPaM& rPam ) +static void lcl_PopNumruleState( + SfxItemState aNumRuleState, const std::shared_ptr<SwNumRuleItem>& aNumRuleItem, + SfxItemState aListIdState, const std::shared_ptr<SfxStringItem>& aListIdItem, + SwTextNode *pDestTextNd, const SwPaM& rPam ) { /* If only a part of one paragraph is copied restore the numrule at the destination. */ @@ -4350,7 +4353,7 @@ static void lcl_PopNumruleState( SfxItemState aNumRuleState, const SwNumRuleItem { if (SfxItemState::SET == aNumRuleState) { - pDestTextNd->SetAttr(aNumRuleItem); + pDestTextNd->SetAttr(*aNumRuleItem); } else { @@ -4358,7 +4361,7 @@ static void lcl_PopNumruleState( SfxItemState aNumRuleState, const SwNumRuleItem } if (SfxItemState::SET == aListIdState) { - pDestTextNd->SetAttr(aListIdItem); + pDestTextNd->SetAttr(*aListIdItem); } else { diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx index 097f8479239e..a7a0a68850f5 100644 --- a/sw/source/core/doc/DocumentStylePoolManager.cxx +++ b/sw/source/core/doc/DocumentStylePoolManager.cxx @@ -1317,10 +1317,9 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId, aLR.SetLeft( GetMetricVal( CM_1 )); aLR.SetRight( GetMetricVal( CM_1 )); aSet.Put( aLR ); - SvxULSpaceItem aUL( RES_UL_SPACE ); - aUL = pNewColl->GetULSpace(); - aUL.SetLower( HTML_PARSPACE ); - aSet.Put( aUL); + std::shared_ptr<SvxULSpaceItem> aUL(static_cast<SvxULSpaceItem*>(pNewColl->GetULSpace().Clone())); + aUL->SetLower( HTML_PARSPACE ); + aSet.Put(*aUL); } break; @@ -1333,10 +1332,9 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId, // The lower paragraph distance is set explicitly (makes // assigning hard attributes easier) - SvxULSpaceItem aULSpaceItem( RES_UL_SPACE ); - aULSpaceItem = pNewColl->GetULSpace(); - aULSpaceItem.SetLower( 0 ); - aSet.Put( aULSpaceItem ); + std::shared_ptr<SvxULSpaceItem> aULSpaceItem(static_cast<SvxULSpaceItem*>(pNewColl->GetULSpace().Clone())); + aULSpaceItem->SetLower( 0 ); + aSet.Put(*aULSpaceItem); } break; @@ -1351,13 +1349,13 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId, aSet.Put( SwParaConnectBorderItem( false ) ); SetAllScriptItem( aSet, SvxFontHeightItem(120, 100, RES_CHRATR_FONTSIZE) ); - SvxULSpaceItem aUL( RES_UL_SPACE ); + std::shared_ptr<SvxULSpaceItem> aUL; { pNewColl->SetNextTextFormatColl( *GetTextCollFromPool( RES_POOLCOLL_TEXT )); - aUL = pNewColl->GetULSpace(); + aUL.reset(static_cast<SvxULSpaceItem*>(pNewColl->GetULSpace().Clone())); } - aUL.SetLower( HTML_PARSPACE ); - aSet.Put( aUL); + aUL->SetLower( HTML_PARSPACE ); + aSet.Put(*aUL); SwFormatLineNumber aLN; aLN.SetCountLines( false ); aSet.Put( aLN ); @@ -1366,23 +1364,22 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId, case RES_POOLCOLL_HTML_DD: { - SvxLRSpaceItem aLR( RES_LR_SPACE ); - aLR = pNewColl->GetLRSpace(); + std::shared_ptr<SvxLRSpaceItem> aLR(static_cast<SvxLRSpaceItem*>(pNewColl->GetLRSpace().Clone())); // We indent by 1 cm. The IDs are always 2 away from each other! - aLR.SetLeft( GetMetricVal( CM_1 )); - aSet.Put( aLR ); + aLR->SetLeft( GetMetricVal( CM_1 )); + aSet.Put(*aLR); } break; case RES_POOLCOLL_HTML_DT: { - SvxLRSpaceItem aLR( RES_LR_SPACE ); + std::shared_ptr<SvxLRSpaceItem> aLR; { pNewColl->SetNextTextFormatColl( *GetTextCollFromPool( RES_POOLCOLL_HTML_DD )); - aLR = pNewColl->GetLRSpace(); + aLR.reset(static_cast<SvxLRSpaceItem*>(pNewColl->GetLRSpace().Clone())); } // We indent by 0 cm. The IDs are always 2 away from each other! - aLR.SetLeft( 0 ); - aSet.Put( aLR ); + aLR->SetLeft( 0 ); + aSet.Put( *aLR ); } break; } diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 286064fddab8..ec866b0c4e83 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -785,9 +785,9 @@ lcl_InsertLabel(SwDoc & rDoc, SwTextFormatColls *const pTextFormatCollTable, pNewSet->Put( pOldFormat->GetAnchor() ); // The new one should be changeable in its height. - SwFormatFrameSize aFrameSize( pOldFormat->GetFrameSize() ); - aFrameSize.SetHeightSizeType( ATT_MIN_SIZE ); - pNewSet->Put( aFrameSize ); + std::shared_ptr<SwFormatFrameSize> aFrameSize(static_cast<SwFormatFrameSize*>(pOldFormat->GetFrameSize().Clone())); + aFrameSize->SetHeightSizeType( ATT_MIN_SIZE ); + pNewSet->Put( *aFrameSize ); SwStartNode* pSttNd = rDoc.GetNodes().MakeTextSection( SwNodeIndex( rDoc.GetNodes().GetEndOfAutotext() ), @@ -834,7 +834,7 @@ lcl_InsertLabel(SwDoc & rDoc, SwTextFormatColls *const pTextFormatCollTable, pNewSet->Put( SwFormatVertOrient( 0, eVert ) ); pNewSet->Put( SwFormatHoriOrient( 0, text::HoriOrientation::CENTER ) ); - aFrameSize = pOldFormat->GetFrameSize(); + aFrameSize.reset(static_cast<SwFormatFrameSize*>(pOldFormat->GetFrameSize().Clone())); SwOLENode* pOleNode = rDoc.GetNodes()[nNdIdx + 1]->GetOLENode(); bool isMath = false; @@ -847,9 +847,9 @@ lcl_InsertLabel(SwDoc & rDoc, SwTextFormatColls *const pTextFormatCollTable, isMath = ( SotExchange::IsMath( aCLSID ) != 0 ); } } - aFrameSize.SetWidthPercent(isMath ? 0 : 100); - aFrameSize.SetHeightPercent(SwFormatFrameSize::SYNCED); - pNewSet->Put( aFrameSize ); + aFrameSize->SetWidthPercent(isMath ? 0 : 100); + aFrameSize->SetHeightPercent(SwFormatFrameSize::SYNCED); + pNewSet->Put( *aFrameSize ); // Hard-set the attributes, because they could come from the Template // and then size calculations could not be correct anymore. diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx index fbf6270bdd8c..102ac460111d 100644 --- a/sw/source/core/doc/tblafmt.cxx +++ b/sw/source/core/doc/tblafmt.cxx @@ -44,6 +44,11 @@ #include <sal/log.hxx> #include <osl/diagnose.h> +#include <svl/legacyitem.hxx> +#include <editeng/legacyitem.hxx> +#include <svx/legacyitem.hxx> +#include <legacyitem.hxx> + #include <memory> #include <vector> @@ -66,20 +71,9 @@ const sal_uInt16 AUTOFORMAT_DATA_ID_504 = 9802; const sal_uInt16 AUTOFORMAT_DATA_ID_552 = 9902; -// --- from 641 on: CJK and CTL font settings -const sal_uInt16 AUTOFORMAT_DATA_ID_641 = 10002; - -// --- from 680/dr14 on: diagonal frame lines -const sal_uInt16 AUTOFORMAT_ID_680DR14 = 10011; -const sal_uInt16 AUTOFORMAT_DATA_ID_680DR14 = 10012; - // --- from 680/dr25 on: store strings as UTF-8 const sal_uInt16 AUTOFORMAT_ID_680DR25 = 10021; -// --- from DEV300/overline2 on: overline -const sal_uInt16 AUTOFORMAT_ID_300OVRLN = 10031; -const sal_uInt16 AUTOFORMAT_DATA_ID_300OVRLN = 10032; - // --- Bug fix to fdo#31005: Table Autoformats does not save/apply all properties (Writer and Calc) const sal_uInt16 AUTOFORMAT_ID_31005 = 10041; const sal_uInt16 AUTOFORMAT_DATA_ID_31005 = 10042; @@ -164,187 +158,109 @@ namespace // Struct with version numbers of the Items -struct SwAfVersions +struct SwAfVersions : public AutoFormatVersions { public: - sal_uInt16 nFontVersion; - sal_uInt16 nFontHeightVersion; - sal_uInt16 nWeightVersion; - sal_uInt16 nPostureVersion; - sal_uInt16 nUnderlineVersion; - sal_uInt16 nOverlineVersion; - sal_uInt16 nCrossedOutVersion; - sal_uInt16 nContourVersion; - sal_uInt16 nShadowedVersion; - sal_uInt16 nColorVersion; - sal_uInt16 nBoxVersion; - sal_uInt16 nLineVersion; - sal_uInt16 nBrushVersion; - - sal_uInt16 nAdjustVersion; sal_uInt16 m_nTextOrientationVersion; sal_uInt16 m_nVerticalAlignmentVersion; - sal_uInt16 nHorJustifyVersion; - sal_uInt16 nVerJustifyVersion; - sal_uInt16 nOrientationVersion; - sal_uInt16 nMarginVersion; - sal_uInt16 nBoolVersion; - sal_uInt16 nInt32Version; - sal_uInt16 nRotateModeVersion; - - sal_uInt16 nNumFormatVersion; - SwAfVersions(); void Load( SvStream& rStream, sal_uInt16 nVer ); + static void Write(SvStream& rStream, sal_uInt16 fileVersion); }; -SwAfVersions::SwAfVersions() : - nFontVersion(0), - nFontHeightVersion(0), - nWeightVersion(0), - nPostureVersion(0), - nUnderlineVersion(0), - nOverlineVersion(0), - nCrossedOutVersion(0), - nContourVersion(0), - nShadowedVersion(0), - nColorVersion(0), - nBoxVersion(0), - nLineVersion(0), - nBrushVersion(0), - nAdjustVersion(0), +SwAfVersions::SwAfVersions() +: AutoFormatVersions(), m_nTextOrientationVersion(0), - m_nVerticalAlignmentVersion(0), - nHorJustifyVersion(0), - nVerJustifyVersion(0), - nOrientationVersion(0), - nMarginVersion(0), - nBoolVersion(0), - nInt32Version(0), - nRotateModeVersion(0), - nNumFormatVersion(0) + m_nVerticalAlignmentVersion(0) { } void SwAfVersions::Load( SvStream& rStream, sal_uInt16 nVer ) { - rStream.ReadUInt16( nFontVersion ); - rStream.ReadUInt16( nFontHeightVersion ); - rStream.ReadUInt16( nWeightVersion ); - rStream.ReadUInt16( nPostureVersion ); - rStream.ReadUInt16( nUnderlineVersion ); - if ( nVer >= AUTOFORMAT_ID_300OVRLN ) - rStream.ReadUInt16( nOverlineVersion ); - rStream.ReadUInt16( nCrossedOutVersion ); - rStream.ReadUInt16( nContourVersion ); - rStream.ReadUInt16( nShadowedVersion ); - rStream.ReadUInt16( nColorVersion ); - rStream.ReadUInt16( nBoxVersion ); - if ( nVer >= AUTOFORMAT_ID_680DR14 ) - rStream.ReadUInt16( nLineVersion ); - rStream.ReadUInt16( nBrushVersion ); - rStream.ReadUInt16( nAdjustVersion ); + LoadBlockA(rStream, nVer); if (nVer >= AUTOFORMAT_ID_31005 && WriterSpecificBlockExists(rStream)) { rStream.ReadUInt16( m_nTextOrientationVersion ); rStream.ReadUInt16( m_nVerticalAlignmentVersion ); } + LoadBlockB(rStream, nVer); +} - rStream.ReadUInt16( nHorJustifyVersion ); - rStream.ReadUInt16( nVerJustifyVersion ); - rStream.ReadUInt16( nOrientationVersion ); - rStream.ReadUInt16( nMarginVersion ); - rStream.ReadUInt16( nBoolVersion ); - if ( nVer >= AUTOFORMAT_ID_504 ) +void SwAfVersions::Write(SvStream& rStream, sal_uInt16 fileVersion) +{ + AutoFormatVersions::WriteBlockA(rStream, fileVersion); + + if (fileVersion >= SOFFICE_FILEFORMAT_50) { - rStream.ReadUInt16( nInt32Version ); - rStream.ReadUInt16( nRotateModeVersion ); + WriterSpecificAutoFormatBlock block(rStream); + + rStream.WriteUInt16(legacy::SvxFrameDirection::GetVersion(fileVersion)); + rStream.WriteUInt16(legacy::SwFormatVert::GetVersion(fileVersion)); } - rStream.ReadUInt16( nNumFormatVersion ); + + AutoFormatVersions::WriteBlockB(rStream, fileVersion); } + + SwBoxAutoFormat::SwBoxAutoFormat() - : m_aFont( *GetDfltAttr( RES_CHRATR_FONT ) ), - m_aHeight( 240, 100, RES_CHRATR_FONTSIZE ), - m_aWeight( WEIGHT_NORMAL, RES_CHRATR_WEIGHT ), - m_aPosture( ITALIC_NONE, RES_CHRATR_POSTURE ), - - m_aCJKFont( *GetDfltAttr( RES_CHRATR_CJK_FONT ) ), - m_aCJKHeight( 240, 100, RES_CHRATR_CJK_FONTSIZE ), - m_aCJKWeight( WEIGHT_NORMAL, RES_CHRATR_CJK_WEIGHT ), - m_aCJKPosture( ITALIC_NONE, RES_CHRATR_CJK_POSTURE ), - - m_aCTLFont( *GetDfltAttr( RES_CHRATR_CTL_FONT ) ), - m_aCTLHeight( 240, 100, RES_CHRATR_CTL_FONTSIZE ), - m_aCTLWeight( WEIGHT_NORMAL, RES_CHRATR_CTL_WEIGHT ), - m_aCTLPosture( ITALIC_NONE, RES_CHRATR_CTL_POSTURE ), - - m_aUnderline( LINESTYLE_NONE, RES_CHRATR_UNDERLINE ), - m_aOverline( LINESTYLE_NONE, RES_CHRATR_OVERLINE ), - m_aCrossedOut( STRIKEOUT_NONE, RES_CHRATR_CROSSEDOUT ), - m_aContour( false, RES_CHRATR_CONTOUR ), - m_aShadowed( false, RES_CHRATR_SHADOWED ), - m_aColor( RES_CHRATR_COLOR ), - m_aBox( RES_BOX ), - m_aTLBR( 0 ), - m_aBLTR( 0 ), - m_aBackground( RES_BACKGROUND ), - m_aAdjust( SvxAdjust::Left, RES_PARATR_ADJUST ), - m_aTextOrientation(SvxFrameDirection::Environment, RES_FRAMEDIR), - m_aVerticalAlignment(0, css::text::VertOrientation::NONE, css::text::RelOrientation::FRAME), - m_aHorJustify( SvxCellHorJustify::Standard, 0), - m_aVerJustify( SvxCellVerJustify::Standard, 0), - m_aStacked( 0 ), - m_aMargin( 0 ), - m_aLinebreak( 0 ), - m_aRotateAngle( 0 ), +: AutoFormatBase(), + m_aTextOrientation(std::make_shared<SvxFrameDirectionItem>(SvxFrameDirection::Environment, RES_FRAMEDIR)), + m_aVerticalAlignment(std::make_shared<SwFormatVertOrient>(0, css::text::VertOrientation::NONE, css::text::RelOrientation::FRAME)), + m_sNumFormatString(), + m_eSysLanguage(::GetAppLanguage()), + m_eNumFormatLanguage(::GetAppLanguage()), + m_wXObject() +{ + // need to set default instances for base class AutoFormatBase here + // due to ressource defines (e.g. RES_CHRATR_FONT) which are not available + // in svx and different in the different usages of derivations + m_aFont = std::make_shared<SvxFontItem>(*GetDfltAttr( RES_CHRATR_FONT ) ); + m_aHeight = std::make_shared<SvxFontHeightItem>(240, 100, RES_CHRATR_FONTSIZE ); + m_aWeight = std::make_shared<SvxWeightItem>(WEIGHT_NORMAL, RES_CHRATR_WEIGHT ); + m_aPosture = std::make_shared<SvxPostureItem>(ITALIC_NONE, RES_CHRATR_POSTURE ); + m_aCJKFont = std::make_shared<SvxFontItem>(*GetDfltAttr( RES_CHRATR_CJK_FONT ) ); + m_aCJKHeight = std::make_shared<SvxFontHeightItem>(240, 100, RES_CHRATR_CJK_FONTSIZE ); + m_aCJKWeight = std::make_shared<SvxWeightItem>(WEIGHT_NORMAL, RES_CHRATR_CJK_WEIGHT ); + m_aCJKPosture = std::make_shared<SvxPostureItem>(ITALIC_NONE, RES_CHRATR_CJK_POSTURE ); + m_aCTLFont = std::make_shared<SvxFontItem>(*GetDfltAttr( RES_CHRATR_CTL_FONT ) ); + m_aCTLHeight = std::make_shared<SvxFontHeightItem>(240, 100, RES_CHRATR_CTL_FONTSIZE ); + m_aCTLWeight = std::make_shared<SvxWeightItem>(WEIGHT_NORMAL, RES_CHRATR_CTL_WEIGHT ); + m_aCTLPosture = std::make_shared<SvxPostureItem>(ITALIC_NONE, RES_CHRATR_CTL_POSTURE ); + m_aUnderline = std::make_shared<SvxUnderlineItem>(LINESTYLE_NONE, RES_CHRATR_UNDERLINE ); + m_aOverline = std::make_shared<SvxOverlineItem>(LINESTYLE_NONE, RES_CHRATR_OVERLINE ); + m_aCrossedOut = std::make_shared<SvxCrossedOutItem>(STRIKEOUT_NONE, RES_CHRATR_CROSSEDOUT ); + m_aContour = std::make_shared<SvxContourItem>(false, RES_CHRATR_CONTOUR ); + m_aShadowed = std::make_shared<SvxShadowedItem>(false, RES_CHRATR_SHADOWED ); + m_aColor = std::make_shared<SvxColorItem>(RES_CHRATR_COLOR ); + m_aBox = std::make_shared<SvxBoxItem>(RES_BOX ); + m_aTLBR = std::make_shared<SvxLineItem>(0 ); + m_aBLTR = std::make_shared<SvxLineItem>(0 ); + m_aBackground = std::make_shared<SvxBrushItem>(RES_BACKGROUND ); + m_aAdjust = std::make_shared<SvxAdjustItem>(SvxAdjust::Left, RES_PARATR_ADJUST ); + m_aHorJustify = std::make_shared<SvxHorJustifyItem>(SvxCellHorJustify::Standard, 0); + m_aVerJustify = std::make_shared<SvxVerJustifyItem>(SvxCellVerJustify::Standard, 0); + m_aStacked = std::make_shared<SfxBoolItem>(0 ); + m_aMargin = std::make_shared<SvxMarginItem>(0 ); + m_aLinebreak = std::make_shared<SfxBoolItem>(0 ); + m_aRotateAngle = std::make_shared<SfxInt32Item>(0 ); + m_aRotateMode = std::make_shared<SvxRotateModeItem>(SVX_ROTATE_MODE_STANDARD, 0 ); // FIXME - add attribute IDs for the diagonal line items // aTLBR( RES_... ), // aBLTR( RES_... ), - m_aRotateMode( SVX_ROTATE_MODE_STANDARD, 0 ) -{ - m_eSysLanguage = m_eNumFormatLanguage = ::GetAppLanguage(); - m_aBox.SetAllDistances(55); + m_aBox->SetAllDistances(55); } SwBoxAutoFormat::SwBoxAutoFormat( const SwBoxAutoFormat& rNew ) - : m_aFont( rNew.m_aFont ), - m_aHeight( rNew.m_aHeight ), - m_aWeight( rNew.m_aWeight ), - m_aPosture( rNew.m_aPosture ), - m_aCJKFont( rNew.m_aCJKFont ), - m_aCJKHeight( rNew.m_aCJKHeight ), - m_aCJKWeight( rNew.m_aCJKWeight ), - m_aCJKPosture( rNew.m_aCJKPosture ), - m_aCTLFont( rNew.m_aCTLFont ), - m_aCTLHeight( rNew.m_aCTLHeight ), - m_aCTLWeight( rNew.m_aCTLWeight ), - m_aCTLPosture( rNew.m_aCTLPosture ), - m_aUnderline( rNew.m_aUnderline ), - m_aOverline( rNew.m_aOverline ), - m_aCrossedOut( rNew.m_aCrossedOut ), - m_aContour( rNew.m_aContour ), - m_aShadowed( rNew.m_aShadowed ), - m_aColor( rNew.m_aColor ), - m_aBox( rNew.m_aBox ), - m_aTLBR( rNew.m_aTLBR ), - m_aBLTR( rNew.m_aBLTR ), - m_aBackground( rNew.m_aBackground ), - m_aAdjust( rNew.m_aAdjust ), - m_aTextOrientation(rNew.m_aTextOrientation), - m_aVerticalAlignment(rNew.m_aVerticalAlignment), - m_aHorJustify( rNew.m_aHorJustify ), - m_aVerJustify( rNew.m_aVerJustify ), - m_aStacked( rNew.m_aStacked ), - m_aMargin( rNew.m_aMargin ), - m_aLinebreak( rNew.m_aLinebreak ), - m_aRotateAngle( rNew.m_aRotateAngle ), - m_aRotateMode( rNew.m_aRotateMode ), +: AutoFormatBase(rNew), + m_aTextOrientation(static_cast<SvxFrameDirectionItem*>(rNew.m_aTextOrientation->Clone())), + m_aVerticalAlignment(static_cast<SwFormatVertOrient*>(rNew.m_aVerticalAlignment->Clone())), m_sNumFormatString( rNew.m_sNumFormatString ), m_eSysLanguage( rNew.m_eSysLanguage ), - m_eNumFormatLanguage( rNew.m_eNumFormatLanguage ) + m_eNumFormatLanguage( rNew.m_eNumFormatLanguage ), + m_wXObject() { } @@ -352,139 +268,27 @@ SwBoxAutoFormat::~SwBoxAutoFormat() { } -SwBoxAutoFormat& SwBoxAutoFormat::operator=( const SwBoxAutoFormat& rNew ) -{ - m_aFont = rNew.m_aFont; - m_aHeight = rNew.m_aHeight; - m_aWeight = rNew.m_aWeight; - m_aPosture = rNew.m_aPosture; - m_aCJKFont = rNew.m_aCJKFont; - m_aCJKHeight = rNew.m_aCJKHeight; - m_aCJKWeight = rNew.m_aCJKWeight; - m_aCJKPosture = rNew.m_aCJKPosture; - m_aCTLFont = rNew.m_aCTLFont; - m_aCTLHeight = rNew.m_aCTLHeight; - m_aCTLWeight = rNew.m_aCTLWeight; - m_aCTLPosture = rNew.m_aCTLPosture; - m_aUnderline = rNew.m_aUnderline; - m_aOverline = rNew.m_aOverline; - m_aCrossedOut = rNew.m_aCrossedOut; - m_aContour = rNew.m_aContour; - m_aShadowed = rNew.m_aShadowed; - m_aColor = rNew.m_aColor; - SetAdjust( rNew.m_aAdjust ); - m_aTextOrientation = rNew.m_aTextOrientation; - m_aVerticalAlignment = rNew.m_aVerticalAlignment; - m_aBox = rNew.m_aBox; - m_aTLBR = rNew.m_aTLBR; - m_aBLTR = rNew.m_aBLTR; - m_aBackground = rNew.m_aBackground; - - m_aHorJustify = rNew.m_aHorJustify; - m_aVerJustify = rNew.m_aVerJustify; - m_aStacked.SetValue( rNew.m_aStacked.GetValue() ); - m_aMargin = rNew.m_aMargin; - m_aLinebreak.SetValue( rNew.m_aLinebreak.GetValue() ); - m_aRotateAngle.SetValue( rNew.m_aRotateAngle.GetValue() ); - m_aRotateMode.SetValue( rNew.m_aRotateMode.GetValue() ); - - m_sNumFormatString = rNew.m_sNumFormatString; - m_eSysLanguage = rNew.m_eSysLanguage; - m_eNumFormatLanguage = rNew.m_eNumFormatLanguage; - - return *this; -} - bool SwBoxAutoFormat::operator==(const SwBoxAutoFormat& rRight) { return GetBackground().GetColor() == rRight.GetBackground().GetColor(); } -#define READ( aItem, aItemType, nVers )\ - pNew = aItem.Create(rStream, nVers ); \ - aItem = *static_cast<aItemType*>(pNew); \ - delete pNew; - bool SwBoxAutoFormat::Load( SvStream& rStream, const SwAfVersions& rVersions, sal_uInt16 nVer ) { - SfxPoolItem* pNew; - SvxOrientationItem aOrientation( SvxCellOrientation::Standard, 0); - - READ( m_aFont, SvxFontItem , rVersions.nFontVersion) - - if( rStream.GetStreamCharSet() == m_aFont.GetCharSet() ) - m_aFont.SetCharSet(::osl_getThreadTextEncoding()); - - READ( m_aHeight, SvxFontHeightItem , rVersions.nFontHeightVersion) - READ( m_aWeight, SvxWeightItem , rVersions.nWeightVersion) - READ( m_aPosture, SvxPostureItem , rVersions.nPostureVersion) - // --- from 641 on: CJK and CTL font settings - if( AUTOFORMAT_DATA_ID_641 <= nVer ) - { - READ( m_aCJKFont, SvxFontItem , rVersions.nFontVersion) - READ( m_aCJKHeight, SvxFontHeightItem , rVersions.nFontHeightVersion) - READ( m_aCJKWeight, SvxWeightItem , rVersions.nWeightVersion) - READ( m_aCJKPosture, SvxPostureItem , rVersions.nPostureVersion) - READ( m_aCTLFont, SvxFontItem , rVersions.nFontVersion) - READ( m_aCTLHeight, SvxFontHeightItem , rVersions.nFontHeightVersion) - READ( m_aCTLWeight, SvxWeightItem , rVersions.nWeightVersion) - READ( m_aCTLPosture, SvxPostureItem , rVersions.nPostureVersion) - } - READ( m_aUnderline, SvxUnderlineItem , rVersions.nUnderlineVersion) - if( nVer >= AUTOFORMAT_DATA_ID_300OVRLN ) - { - READ( m_aOverline, SvxOverlineItem , rVersions.nOverlineVersion) - } - READ( m_aCrossedOut, SvxCrossedOutItem , rVersions.nCrossedOutVersion) - READ( m_aContour, SvxContourItem , rVersions.nContourVersion) - READ( m_aShadowed, SvxShadowedItem , rVersions.nShadowedVersion) - READ( m_aColor, SvxColorItem , rVersions.nColorVersion) - - READ( m_aBox, SvxBoxItem , rVersions.nBoxVersion) - - // --- from 680/dr14 on: diagonal frame lines - if( nVer >= AUTOFORMAT_DATA_ID_680DR14 ) - { - READ( m_aTLBR, SvxLineItem, rVersions.nLineVersion) - READ( m_aBLTR, SvxLineItem, rVersions.nLineVersion) - } - - READ( m_aBackground, SvxBrushItem , rVersions.nBrushVersion) - - pNew = m_aAdjust.Create(rStream, rVersions.nAdjustVersion ); - SetAdjust( *static_cast<SvxAdjustItem*>(pNew) ); - delete pNew; + LoadBlockA( rStream, rVersions, nVer ); if (nVer >= AUTOFORMAT_DATA_ID_31005) { sal_Int64 const nSize(WriterSpecificBlockExists(rStream)); if (0 < nSize && nSize < std::numeric_limits<sal_uInt16>::max()) { - READ(m_aTextOrientation, SvxFrameDirectionItem, rVersions.m_nTextOrientationVersion); + legacy::SvxFrameDirection::Create(*m_aTextOrientation, rStream, rVersions.m_nTextOrientationVersion); // HORRIBLE HACK to read both 32-bit and 64-bit "long": abuse nSize - READ(m_aVerticalAlignment, SwFormatVertOrient, /*rVersions.m_nVerticalAlignmentVersion*/ nSize); + legacy::SwFormatVert::Create(*m_aVerticalAlignment, rStream, /*rVersions.m_nVerticalAlignmentVersion*/ nSize); } } - READ( m_aHorJustify, SvxHorJustifyItem , rVersions.nHorJustifyVersion) - READ( m_aVerJustify, SvxVerJustifyItem , rVersions.nVerJustifyVersion) - - READ( aOrientation, SvxOrientationItem , rVersions.nOrientationVersion) - READ( m_aMargin, SvxMarginItem , rVersions.nMarginVersion) - - pNew = m_aLinebreak.Create(rStream, rVersions.nBoolVersion ); - m_aLinebreak.SetValue( static_cast<SfxBoolItem*>(pNew)->GetValue() ); - delete pNew; - - if ( nVer >= AUTOFORMAT_DATA_ID_504 ) - { - pNew = m_aRotateAngle.Create( rStream, rVersions.nInt32Version ); - m_aRotateAngle.SetValue( static_cast<SfxInt32Item*>(pNew)->GetValue() ); - delete pNew; - pNew = m_aRotateMode.Create( rStream, rVersions.nRotateModeVersion ); - m_aRotateMode.SetValue( static_cast<SvxRotateModeItem*>(pNew)->GetValue() ); - delete pNew; - } + LoadBlockB( rStream, rVersions, nVer ); if( 0 == rVersions.nNumFormatVersion ) { @@ -499,56 +303,22 @@ bool SwBoxAutoFormat::Load( SvStream& rStream, const SwAfVersions& rVersions, sa m_eSysLanguage = ::GetAppLanguage(); } - m_aStacked.SetValue( aOrientation.IsStacked() ); - m_aRotateAngle.SetValue( aOrientation.GetRotation( m_aRotateAngle.GetValue() ) ); - return ERRCODE_NONE == rStream.GetError(); } bool SwBoxAutoFormat::Save( SvStream& rStream, sal_uInt16 fileVersion ) const { - SvxOrientationItem aOrientation( m_aRotateAngle.GetValue(), m_aStacked.GetValue(), 0 ); - - m_aFont.Store( rStream, m_aFont.GetVersion(fileVersion) ); - m_aHeight.Store( rStream, m_aHeight.GetVersion(fileVersion) ); - m_aWeight.Store( rStream, m_aWeight.GetVersion(fileVersion) ); - m_aPosture.Store( rStream, m_aPosture.GetVersion(fileVersion) ); - m_aCJKFont.Store( rStream, m_aCJKFont.GetVersion(fileVersion) ); - m_aCJKHeight.Store( rStream, m_aCJKHeight.GetVersion(fileVersion) ); - m_aCJKWeight.Store( rStream, m_aCJKWeight.GetVersion(fileVersion) ); - m_aCJKPosture.Store( rStream, m_aCJKPosture.GetVersion(fileVersion) ); - m_aCTLFont.Store( rStream, m_aCTLFont.GetVersion(fileVersion) ); - m_aCTLHeight.Store( rStream, m_aCTLHeight.GetVersion(fileVersion) ); - m_aCTLWeight.Store( rStream, m_aCTLWeight.GetVersion(fileVersion) ); - m_aCTLPosture.Store( rStream, m_aCTLPosture.GetVersion(fileVersion) ); - m_aUnderline.Store( rStream, m_aUnderline.GetVersion(fileVersion) ); - m_aOverline.Store( rStream, m_aOverline.GetVersion(fileVersion) ); - m_aCrossedOut.Store( rStream, m_aCrossedOut.GetVersion(fileVersion) ); - m_aContour.Store( rStream, m_aContour.GetVersion(fileVersion) ); - m_aShadowed.Store( rStream, m_aShadowed.GetVersion(fileVersion) ); - m_aColor.Store( rStream, m_aColor.GetVersion(fileVersion) ); - m_aBox.Store( rStream, m_aBox.GetVersion(fileVersion) ); - m_aTLBR.Store( rStream, m_aTLBR.GetVersion(fileVersion) ); - m_aBLTR.Store( rStream, m_aBLTR.GetVersion(fileVersion) ); - m_aBackground.Store( rStream, m_aBackground.GetVersion(fileVersion) ); - - m_aAdjust.Store( rStream, m_aAdjust.GetVersion(fileVersion) ); + SaveBlockA( rStream, fileVersion ); + if (fileVersion >= SOFFICE_FILEFORMAT_50) { WriterSpecificAutoFormatBlock block(rStream); - m_aTextOrientation.Store(rStream, m_aTextOrientation.GetVersion(fileVersion)); - m_aVerticalAlignment.Store(rStream, m_aVerticalAlignment.GetVersion(fileVersion)); + legacy::SvxFrameDirection::Store(*m_aTextOrientation, rStream, legacy::SvxFrameDirection::GetVersion(fileVersion)); + legacy::SwFormatVert::Store(*m_aVerticalAlignment, rStream, legacy::SwFormatVert::GetVersion(fileVersion)); } - m_aHorJustify.Store( rStream, m_aHorJustify.GetVersion(fileVersion) ); - m_aVerJustify.Store( rStream, m_aVerJustify.GetVersion(fileVersion) ); - aOrientation.Store( rStream, aOrientation.GetVersion(fileVersion) ); - m_aMargin.Store( rStream, m_aMargin.GetVersion(fileVersion) ); - m_aLinebreak.Store( rStream, m_aLinebreak.GetVersion(fileVersion) ); - // Calc Rotation from SO5 - m_aRotateAngle.Store( rStream, m_aRotateAngle.GetVersion(fileVersion) ); - m_aRotateMode.Store( rStream, m_aRotateMode.GetVersion(fileVersion) ); + SaveBlockB( rStream, fileVersion ); // --- from 680/dr25 on: store strings as UTF-8 write_uInt16_lenPrefixed_uInt8s_FromOUString(rStream, m_sNumFormatString, @@ -558,53 +328,16 @@ bool SwBoxAutoFormat::Save( SvStream& rStream, sal_uInt16 fileVersion ) const return ERRCODE_NONE == rStream.GetError(); } -void SwBoxAutoFormat::SaveVersionNo( SvStream& rStream, sal_uInt16 fileVersion ) const -{ - rStream.WriteUInt16( m_aFont.GetVersion( fileVersion ) ); - rStream.WriteUInt16( m_aHeight.GetVersion( fileVersion ) ); - rStream.WriteUInt16( m_aWeight.GetVersion( fileVersion ) ); - rStream.WriteUInt16( m_aPosture.GetVersion( fileVersion ) ); - rStream.WriteUInt16( m_aUnderline.GetVersion( fileVersion ) ); - rStream.WriteUInt16( m_aOverline.GetVersion( fileVersion ) ); - rStream.WriteUInt16( m_aCrossedOut.GetVersion( fileVersion ) ); - rStream.WriteUInt16( m_aContour.GetVersion( fileVersion ) ); - rStream.WriteUInt16( m_aShadowed.GetVersion( fileVersion ) ); - rStream.WriteUInt16( m_aColor.GetVersion( fileVersion ) ); - rStream.WriteUInt16( m_aBox.GetVersion( fileVersion ) ); - rStream.WriteUInt16( m_aTLBR.GetVersion( fileVersion ) ); - rStream.WriteUInt16( m_aBackground.GetVersion( fileVersion ) ); - - rStream.WriteUInt16( m_aAdjust.GetVersion( fileVersion ) ); - - if (fileVersion >= SOFFICE_FILEFORMAT_50) - { - WriterSpecificAutoFormatBlock block(rStream); - - rStream.WriteUInt16( m_aTextOrientation.GetVersion(fileVersion) ); - rStream.WriteUInt16( m_aVerticalAlignment.GetVersion(fileVersion) ); - } - - rStream.WriteUInt16( m_aHorJustify.GetVersion( fileVersion ) ); - rStream.WriteUInt16( m_aVerJustify.GetVersion( fileVersion ) ); - rStream.WriteUInt16( SvxOrientationItem(SvxCellOrientation::Standard, 0).GetVersion( fileVersion ) ); - rStream.WriteUInt16( m_aMargin.GetVersion( fileVersion ) ); - rStream.WriteUInt16( m_aLinebreak.GetVersion( fileVersion ) ); - rStream.WriteUInt16( m_aRotateAngle.GetVersion( fileVersion ) ); - rStream.WriteUInt16( m_aRotateMode.GetVersion( fileVersion ) ); - - rStream.WriteUInt16( 0 ); // NumberFormat -} - SwTableAutoFormat::SwTableAutoFormat( const OUString& rName ) : m_aName( rName ) , m_nStrResId( USHRT_MAX ) - , m_aBreak( SvxBreak::NONE, RES_BREAK ) - , m_aKeepWithNextPara( false, RES_KEEP ) + , m_aBreak(std::make_shared<SvxFormatBreakItem>(SvxBreak::NONE, RES_BREAK)) + , m_aKeepWithNextPara(std::make_shared<SvxFormatKeepItem>(false, RES_KEEP)) , m_aRepeatHeading( 0 ) , m_bLayoutSplit( true ) , m_bRowSplit( true ) , m_bCollapsingBorders(true) - , m_aShadow( RES_SHADOW ) + , m_aShadow(std::make_shared<SvxShadowItem>(RES_SHADOW)) , m_bHidden( false ) , m_bUserDefined( true ) { @@ -619,9 +352,9 @@ SwTableAutoFormat::SwTableAutoFormat( const OUString& rName ) } SwTableAutoFormat::SwTableAutoFormat( const SwTableAutoFormat& rNew ) - : m_aBreak( rNew.m_aBreak ) - , m_aKeepWithNextPara( false, RES_KEEP ) - , m_aShadow( RES_SHADOW ) + : m_aBreak() + , m_aKeepWithNextPara() + , m_aShadow(std::make_shared<SvxShadowItem>(RES_SHADOW)) { for(SwBoxAutoFormat* & rp : m_aBoxAutoFormat) rp = nullptr; @@ -654,14 +387,14 @@ SwTableAutoFormat& SwTableAutoFormat::operator=( const SwTableAutoFormat& rNew ) m_bInclValueFormat = rNew.m_bInclValueFormat; m_bInclWidthHeight = rNew.m_bInclWidthHeight; - m_aBreak = rNew.m_aBreak; + m_aBreak.reset(static_cast<SvxFormatBreakItem*>(rNew.m_aBreak->Clone())); m_aPageDesc = rNew.m_aPageDesc; - m_aKeepWithNextPara = rNew.m_aKeepWithNextPara; + m_aKeepWithNextPara.reset(static_cast<SvxFormatKeepItem*>(rNew.m_aKeepWithNextPara->Clone())); m_aRepeatHeading = rNew.m_aRepeatHeading; m_bLayoutSplit = rNew.m_bLayoutSplit; m_bRowSplit = rNew.m_bRowSplit; m_bCollapsingBorders = rNew.m_bCollapsingBorders; - m_aShadow = rNew.m_aShadow; + m_aShadow.reset(static_cast<SvxShadowItem*>(rNew.m_aShadow->Clone())); m_bHidden = rNew.m_bHidden; m_bUserDefined = rNew.m_bUserDefined; @@ -904,12 +637,12 @@ void SwTableAutoFormat::RestoreTableProperties(SwTable &table) const SfxItemSet rSet(pDoc->GetAttrPool(), aTableSetRange); - rSet.Put(m_aBreak); + rSet.Put(*m_aBreak); rSet.Put(m_aPageDesc); rSet.Put(SwFormatLayoutSplit(m_bLayoutSplit)); rSet.Put(SfxBoolItem(RES_COLLAPSING_BORDERS, m_bCollapsingBorders)); - rSet.Put(m_aKeepWithNextPara); - rSet.Put(m_aShadow); + rSet.Put(*m_aKeepWithNextPara); + rSet.Put(*m_aShadow); pFormat->SetFormatAttr(rSet); @@ -936,15 +669,15 @@ void SwTableAutoFormat::StoreTableProperties(const SwTable &table) const SfxItemSet &rSet = pFormat->GetAttrSet(); - m_aBreak = rSet.Get(RES_BREAK); + m_aBreak.reset(static_cast<SvxFormatBreakItem*>(rSet.Get(RES_BREAK).Clone())); m_aPageDesc = rSet.Get(RES_PAGEDESC); const SwFormatLayoutSplit &layoutSplit = rSet.Get(RES_LAYOUT_SPLIT); m_bLayoutSplit = layoutSplit.GetValue(); m_bCollapsingBorders = rSet.Get(RES_COLLAPSING_BORDERS).GetValue(); - m_aKeepWithNextPara = rSet.Get(RES_KEEP); + m_aKeepWithNextPara.reset(static_cast<SvxFormatKeepItem*>(rSet.Get(RES_KEEP).Clone())); m_aRepeatHeading = table.GetRowsToRepeat(); - m_aShadow = rSet.Get(RES_SHADOW); + m_aShadow.reset(static_cast<SvxShadowItem*>(rSet.Get(RES_SHADOW).Clone())); } bool SwTableAutoFormat::FirstRowEndColumnIsRow() @@ -997,15 +730,13 @@ bool SwTableAutoFormat::Load( SvStream& rStream, const SwAfVersions& rVersions ) if (nVal >= AUTOFORMAT_DATA_ID_31005 && WriterSpecificBlockExists(rStream)) { - SfxPoolItem* pNew = nullptr; - - READ(m_aBreak, SvxFormatBreakItem, AUTOFORMAT_FILE_VERSION); + legacy::SvxFormatBreak::Create(*m_aBreak, rStream, AUTOFORMAT_FILE_VERSION); //unimplemented READ(m_aPageDesc, SwFormatPageDesc, AUTOFORMAT_FILE_VERSION); - READ(m_aKeepWithNextPara, SvxFormatKeepItem, AUTOFORMAT_FILE_VERSION); + legacy::SvxFormatKeep::Create(*m_aKeepWithNextPara, rStream, AUTOFORMAT_FILE_VERSION); rStream.ReadUInt16( m_aRepeatHeading ).ReadCharAsBool( m_bLayoutSplit ).ReadCharAsBool( m_bRowSplit ).ReadCharAsBool( m_bCollapsingBorders ); - READ(m_aShadow, SvxShadowItem, AUTOFORMAT_FILE_VERSION); + legacy::SvxShadow::Create(*m_aShadow, rStream, AUTOFORMAT_FILE_VERSION); } bRet = ERRCODE_NONE== rStream.GetError(); @@ -1044,11 +775,11 @@ bool SwTableAutoFormat::Save( SvStream& rStream, sal_uInt16 fileVersion ) const { WriterSpecificAutoFormatBlock block(rStream); - m_aBreak.Store(rStream, m_aBreak.GetVersion(fileVersion)); + legacy::SvxFormatBreak::Store(*m_aBreak, rStream, legacy::SvxFormatBreak::GetVersion(fileVersion)); //unimplemented m_aPageDesc.Store(rStream, m_aPageDesc.GetVersion(fileVersion)); - m_aKeepWithNextPara.Store(rStream, m_aKeepWithNextPara.GetVersion(fileVersion)); + legacy::SvxFormatKeep::Store(*m_aKeepWithNextPara, rStream, legacy::SvxFormatKeep::GetVersion(fileVersion)); rStream.WriteUInt16( m_aRepeatHeading ).WriteBool( m_bLayoutSplit ).WriteBool( m_bRowSplit ).WriteBool( m_bCollapsingBorders ); - m_aShadow.Store(rStream, m_aShadow.GetVersion(fileVersion)); + legacy::SvxShadow::Store(*m_aShadow, rStream, legacy::SvxShadow::GetVersion(fileVersion)); } bool bRet = ERRCODE_NONE == rStream.GetError(); @@ -1373,8 +1104,7 @@ bool SwTableAutoFormatTable::Save( SvStream& rStream ) const return false; // Write this version number for all attributes - m_pImpl->m_AutoFormats[0]->GetBoxFormat(0).SaveVersionNo( - rStream, AUTOFORMAT_FILE_VERSION); + SwAfVersions::Write(rStream, AUTOFORMAT_FILE_VERSION); rStream.WriteUInt16( m_pImpl->m_AutoFormats.size() - 1 ); bRet = ERRCODE_NONE == rStream.GetError(); diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index f6c0bb60e715..b414d65847f7 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -1803,20 +1803,43 @@ static void lcl_CopyBoxToDoc(FndBox_ const& rFndBox, CpyPara *const pCpyPara) // Find the Frame Format in the list of all Frame Formats CpyTabFrame aFindFrame(static_cast<SwTableBoxFormat*>(rFndBox.GetBox()->GetFrameFormat())); - SwFormatFrameSize aFrameSz; + std::shared_ptr<SwFormatFrameSize> aFrameSz(std::make_shared<SwFormatFrameSize>()); CpyTabFrames::const_iterator itFind = pCpyPara->rTabFrameArr.lower_bound( aFindFrame ); const CpyTabFrames::size_type nFndPos = itFind - pCpyPara->rTabFrameArr.begin(); - if( itFind == pCpyPara->rTabFrameArr.end() || !(*itFind == aFindFrame) || - ( aFrameSz = ( aFindFrame = pCpyPara->rTabFrameArr[ nFndPos ]).pNewFrameFormat-> - GetFrameSize()).GetWidth() != static_cast<SwTwips>(nSize) ) + + // It *is* sometimes cool to have multiple tests/if's and assignments + // in a single statement, and it is technically possible. But it is definitely + // not simply readable - where from my POV reading code is done 1000 times + // more often than writing it. Thus I dismantled the expression in smaller + // chunks to keep it handy/understandable/changeable (hopefully without error) + // The original for reference: + // if( itFind == pCpyPara->rTabFrameArr.end() || !(*itFind == aFindFrame) || + // ( aFrameSz = ( aFindFrame = pCpyPara->rTabFrameArr[ nFndPos ]).pNewFrameFormat-> + // GetFrameSize()).GetWidth() != static_cast<SwTwips>(nSize) ) + + bool DoCopyIt(itFind == pCpyPara->rTabFrameArr.end()); + + if(!DoCopyIt) + { + DoCopyIt = !(*itFind == aFindFrame); + } + + if(!DoCopyIt) + { + aFindFrame = pCpyPara->rTabFrameArr[ nFndPos ]; + aFrameSz.reset(static_cast<SwFormatFrameSize*>(aFindFrame.pNewFrameFormat->GetFrameSize().Clone())); + DoCopyIt = aFrameSz->GetWidth() != static_cast<SwTwips>(nSize); + } + + if(DoCopyIt) { // It doesn't exist yet, so copy it aFindFrame.pNewFrameFormat = pCpyPara->pDoc->MakeTableBoxFormat(); aFindFrame.pNewFrameFormat->CopyAttrs( *rFndBox.GetBox()->GetFrameFormat() ); if( !pCpyPara->bCpyContent ) aFindFrame.pNewFrameFormat->ResetFormatAttr( RES_BOXATR_FORMULA, RES_BOXATR_VALUE ); - aFrameSz.SetWidth( nSize ); - aFindFrame.pNewFrameFormat->SetFormatAttr( aFrameSz ); + aFrameSz->SetWidth( nSize ); + aFindFrame.pNewFrameFormat->SetFormatAttr( *aFrameSz ); pCpyPara->rTabFrameArr.insert( aFindFrame ); } diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index daf52e4047a9..9781ccd87911 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -498,7 +498,7 @@ void SwDoc::SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew } } -bool SwDoc::GetRowBackground( const SwCursor& rCursor, SvxBrushItem &rToFill ) +bool SwDoc::GetRowBackground( const SwCursor& rCursor, std::shared_ptr<SvxBrushItem>& rToFill ) { bool bRet = false; SwTableNode* pTableNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode(); @@ -513,11 +513,15 @@ bool SwDoc::GetRowBackground( const SwCursor& rCursor, SvxBrushItem &rToFill ) bRet = true; for ( std::vector<SwTableLine*>::size_type i = 1; i < aRowArr.size(); ++i ) - if ( rToFill != aRowArr[i]->GetFrameFormat()->makeBackgroundBrushItem() ) + { + std::shared_ptr<SvxBrushItem> aAlternative(aRowArr[i]->GetFrameFormat()->makeBackgroundBrushItem()); + + if ( rToFill != aAlternative && rToFill && aAlternative && *rToFill != *aAlternative ) { bRet = false; break; } + } } } return bRet; @@ -875,26 +879,28 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor, const_cast<SwTableBox*>(pCell->GetTabBox())->ClaimFrameFormat(); SwFrameFormat *pFormat = pCell->GetFormat(); - SvxBoxItem aBox( pFormat->GetBox() ); + std::shared_ptr<SvxBoxItem> aBox(static_cast<SvxBoxItem*>(pFormat->GetBox().Clone())); if ( !pBorderLine && bSetLine ) - aBox = *::GetDfltAttr( RES_BOX ); + { + aBox.reset(static_cast<SvxBoxItem*>(::GetDfltAttr(RES_BOX)->Clone())); + } else { - if ( aBox.GetTop() ) - ::lcl_SetLineStyle( const_cast<SvxBorderLine*>(aBox.GetTop()), + if ( aBox->GetTop() ) + ::lcl_SetLineStyle( const_cast<SvxBorderLine*>(aBox->GetTop()), pColor, pBorderLine ); - if ( aBox.GetBottom() ) - ::lcl_SetLineStyle( const_cast<SvxBorderLine*>(aBox.GetBottom()), + if ( aBox->GetBottom() ) + ::lcl_SetLineStyle( const_cast<SvxBorderLine*>(aBox->GetBottom()), pColor, pBorderLine ); - if ( aBox.GetLeft() ) - ::lcl_SetLineStyle( const_cast<SvxBorderLine*>(aBox.GetLeft()), + if ( aBox->GetLeft() ) + ::lcl_SetLineStyle( const_cast<SvxBorderLine*>(aBox->GetLeft()), pColor, pBorderLine ); - if ( aBox.GetRight() ) - ::lcl_SetLineStyle( const_cast<SvxBorderLine*>(aBox.GetRight()), + if ( aBox->GetRight() ) + ::lcl_SetLineStyle( const_cast<SvxBorderLine*>(aBox->GetRight()), pColor, pBorderLine ); } - pFormat->SetFormatAttr( aBox ); + pFormat->SetFormatAttr( *aBox ); } } @@ -1178,7 +1184,7 @@ void SwDoc::SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew ) } } -bool SwDoc::GetBoxAttr( const SwCursor& rCursor, SfxPoolItem& rToFill ) +bool SwDoc::GetBoxAttr( const SwCursor& rCursor, std::shared_ptr<SfxPoolItem>& rToFill ) { bool bRet = false; SwTableNode* pTableNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode(); @@ -1187,18 +1193,18 @@ bool SwDoc::GetBoxAttr( const SwCursor& rCursor, SfxPoolItem& rToFill ) { bRet = true; bool bOneFound = false; - const sal_uInt16 nWhich = rToFill.Which(); + const sal_uInt16 nWhich = rToFill->Which(); for (size_t i = 0; i < aBoxes.size(); ++i) { switch ( nWhich ) { case RES_BACKGROUND: { - SvxBrushItem aBack = + std::shared_ptr<SvxBrushItem> aBack = aBoxes[i]->GetFrameFormat()->makeBackgroundBrushItem(); if( !bOneFound ) { - static_cast<SvxBrushItem&>(rToFill) = aBack; + rToFill.reset(aBack->Clone()); bOneFound = true; } else if( rToFill != aBack ) @@ -1212,10 +1218,10 @@ bool SwDoc::GetBoxAttr( const SwCursor& rCursor, SfxPoolItem& rToFill ) aBoxes[i]->GetFrameFormat()->GetFrameDir(); if( !bOneFound ) { - static_cast<SvxFrameDirectionItem&>(rToFill) = rDir; + rToFill.reset(rDir.Clone()); bOneFound = true; } - else if( rToFill != rDir ) + else if( rToFill && *rToFill != rDir ) bRet = false; } break; @@ -1225,10 +1231,10 @@ bool SwDoc::GetBoxAttr( const SwCursor& rCursor, SfxPoolItem& rToFill ) aBoxes[i]->GetFrameFormat()->GetVertOrient(); if( !bOneFound ) { - static_cast<SwFormatVertOrient&>(rToFill) = rOrient; + rToFill.reset(rOrient.Clone()); bOneFound = true; } - else if( rToFill != rOrient ) + else if( rToFill && *rToFill != rOrient ) bRet = false; } break; diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index 363f1056583a..f81fb14a647c 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -701,8 +701,8 @@ const SwFrameFormat *SwFEShell::NewFlyFrame( const SfxItemSet& rSet, bool bAnchV GetDoc()->GetIDocumentUndoRedo().StartUndo( SwUndoId::INSLAYFMT, nullptr ); std::unique_ptr<SwFormatAnchor> pOldAnchor; bool bHOriChgd = false, bVOriChgd = false; - SwFormatVertOrient aOldV; - SwFormatHoriOrient aOldH; + std::shared_ptr<SwFormatVertOrient> aOldV; + std::shared_ptr<SwFormatHoriOrient> aOldH; if ( RndStdIds::FLY_AT_PAGE != eRndId ) { @@ -718,14 +718,14 @@ const SwFrameFormat *SwFEShell::NewFlyFrame( const SfxItemSet& rSet, bool bAnchV && text::HoriOrientation::NONE == static_cast<const SwFormatHoriOrient*>(pItem)->GetHoriOrient() ) { bHOriChgd = true; - aOldH = *static_cast<const SwFormatHoriOrient*>(pItem); + aOldH.reset(static_cast<SwFormatHoriOrient*>(pItem->Clone())); const_cast<SfxItemSet&>(rSet).Put( SwFormatHoriOrient( 0, text::HoriOrientation::LEFT ) ); } if( SfxItemState::SET == rSet.GetItemState( RES_VERT_ORIENT, false, &pItem ) && text::VertOrientation::NONE == static_cast<const SwFormatVertOrient*>(pItem)->GetVertOrient() ) { bVOriChgd = true; - aOldV = *static_cast<const SwFormatVertOrient*>(pItem); + aOldV.reset(static_cast<SwFormatVertOrient*>(pItem->Clone())); const_cast<SfxItemSet&>(rSet).Put( SwFormatVertOrient( 0, text::VertOrientation::TOP ) ); } } @@ -773,9 +773,9 @@ const SwFrameFormat *SwFEShell::NewFlyFrame( const SfxItemSet& rSet, bool bAnchV const_cast<SfxItemSet&>(rSet).Put( *pOldAnchor ); if( bHOriChgd ) - const_cast<SfxItemSet&>(rSet).Put( aOldH ); + const_cast<SfxItemSet&>(rSet).Put( *aOldH ); if( bVOriChgd ) - const_cast<SfxItemSet&>(rSet).Put( aOldV ); + const_cast<SfxItemSet&>(rSet).Put( *aOldV ); GetDoc()->SetFlyFrameAttr( *pRet, const_cast<SfxItemSet&>(rSet) ); GetDoc()->GetIDocumentUndoRedo().DoUndo(bDoesUndo); diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index 61a995381a52..a60eff107e9a 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -754,7 +754,7 @@ void SwFEShell::SetRowBackground( const SvxBrushItem &rNew ) EndAllActionAndCall(); } -bool SwFEShell::GetRowBackground( SvxBrushItem &rToFill ) const +bool SwFEShell::GetRowBackground( std::shared_ptr<SvxBrushItem>& rToFill ) const { return SwDoc::GetRowBackground( *getShellCursor( false ), rToFill ); } @@ -790,9 +790,12 @@ void SwFEShell::SetBoxBackground( const SvxBrushItem &rNew ) EndAllActionAndCall(); } -bool SwFEShell::GetBoxBackground( SvxBrushItem &rToFill ) const +bool SwFEShell::GetBoxBackground( std::shared_ptr<SvxBrushItem>& rToFill ) const { - return SwDoc::GetBoxAttr( *getShellCursor( false ), rToFill ); + std::shared_ptr<SfxPoolItem> aTemp(rToFill); + bool bRetval(SwDoc::GetBoxAttr(*getShellCursor( false ), aTemp)); + rToFill = std::static_pointer_cast<SvxBrushItem>(aTemp); + return bRetval; } void SwFEShell::SetBoxDirection( const SvxFrameDirectionItem& rNew ) @@ -803,9 +806,12 @@ void SwFEShell::SetBoxDirection( const SvxFrameDirectionItem& rNew ) EndAllActionAndCall(); } -bool SwFEShell::GetBoxDirection( SvxFrameDirectionItem& rToFill ) const +bool SwFEShell::GetBoxDirection( std::shared_ptr<SvxFrameDirectionItem>& rToFill ) const { - return SwDoc::GetBoxAttr( *getShellCursor( false ), rToFill ); + std::shared_ptr<SfxPoolItem> aTemp(rToFill); + bool bRetval(SwDoc::GetBoxAttr(*getShellCursor( false ), aTemp)); + rToFill = std::static_pointer_cast<SvxFrameDirectionItem>(aTemp); + return bRetval; } void SwFEShell::SetBoxAlign( sal_uInt16 nAlign ) @@ -834,7 +840,7 @@ void SwFEShell::SetTabBackground( const SvxBrushItem &rNew ) GetDoc()->getIDocumentState().SetModified(); } -void SwFEShell::GetTabBackground( SvxBrushItem &rToFill ) const +void SwFEShell::GetTabBackground( std::shared_ptr<SvxBrushItem>& rToFill ) const { SwFrame *pFrame = GetCurrFrame(); if( pFrame && pFrame->IsInTab() ) diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx index 18048e34112b..8765dd034b6f 100644 --- a/sw/source/core/inc/frmtool.hxx +++ b/sw/source/core/inc/frmtool.hxx @@ -281,7 +281,7 @@ class SwBorderAttrs : public SwCacheObj const SwAttrSet &m_rAttrSet; const SvxULSpaceItem &m_rUL; // #i96772# - SvxLRSpaceItem m_rLR; + std::shared_ptr<SvxLRSpaceItem> m_rLR; const SvxBoxItem &m_rBox; const SvxShadowItem &m_rShadow; const Size m_aFrameSize; diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 7c77560c8e33..0cbb44249644 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -1265,48 +1265,6 @@ void SwFormatSurround::dumpAsXml(xmlTextWriterPtr pWriter) const xmlTextWriterEndElement(pWriter); } -SvStream& SwFormatVertOrient::Store(SvStream &rStream, sal_uInt16 /*version*/) const -{ -#if SAL_TYPES_SIZEOFLONG == 8 - rStream.WriteInt64(m_nYPos); -#else - rStream.WriteInt32(m_nYPos); -#endif - rStream.WriteInt16( m_eOrient ).WriteInt16( m_eRelation ); - return rStream; -} - -SfxPoolItem* SwFormatVertOrient::Create(SvStream &rStream, sal_uInt16 nVersionAbusedAsSize) const -{ - SwTwips yPos(0); - sal_Int16 orient(0); - sal_Int16 relation(0); - switch (nVersionAbusedAsSize) - { - // compatibility hack for Table Auto Format: SwTwips is "long" :( - // (this means that the file format is platform dependent) - case 14: - { - sal_Int64 n(0); - rStream.ReadInt64(n); - yPos = n; - } - break; - case 10: - { - sal_Int32 n(0); - rStream.ReadInt32(n); - yPos = n; - } - break; - default: - SAL_WARN("sw.core", "SwFormatVertOrient::Create: unknown size"); - } - rStream.ReadInt16( orient ).ReadInt16( relation ); - - return new SwFormatVertOrient(yPos, orient, relation); -} - // Partially implemented inline in hxx SwFormatVertOrient::SwFormatVertOrient( SwTwips nY, sal_Int16 eVert, sal_Int16 eRel ) @@ -3210,16 +3168,17 @@ bool SwFlyFrameFormat::IsBackgroundTransparent() const // NOTE: If background color is "no fill"/"auto fill" (COL_TRANSPARENT) // and there is no background graphic, it "inherites" the background // from its anchor. - SvxBrushItem aBackground(makeBackgroundBrushItem()); - if ( (aBackground.GetColor().GetTransparency() != 0) && - (aBackground.GetColor() != COL_TRANSPARENT) + std::shared_ptr<SvxBrushItem> aBackground(makeBackgroundBrushItem()); + if ( aBackground && + (aBackground->GetColor().GetTransparency() != 0) && + (aBackground->GetColor() != COL_TRANSPARENT) ) { return true; } else { - const GraphicObject *pTmpGrf = aBackground.GetGraphicObject(); + const GraphicObject *pTmpGrf = aBackground->GetGraphicObject(); if ( pTmpGrf && (pTmpGrf->GetAttr().GetTransparency() != 0) ) @@ -3249,9 +3208,10 @@ bool SwFlyFrameFormat::IsBackgroundBrushInherited() const } else { - SvxBrushItem aBackground(makeBackgroundBrushItem()); - if ( (aBackground.GetColor() == COL_TRANSPARENT) && - !(aBackground.GetGraphicObject()) ) + std::shared_ptr<SvxBrushItem> aBackground(makeBackgroundBrushItem()); + if ( aBackground && + (aBackground->GetColor() == COL_TRANSPARENT) && + !(aBackground->GetGraphicObject()) ) { return true; } diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx index 16a610847978..e7d19227fd88 100644 --- a/sw/source/core/layout/flylay.cxx +++ b/sw/source/core/layout/flylay.cxx @@ -358,9 +358,9 @@ bool SwFlyFreeFrame::supportsAutoContour() const } else { - const SvxBrushItem aBack(GetFormat()->makeBackgroundBrushItem()); + const std::shared_ptr<SvxBrushItem> aBack(GetFormat()->makeBackgroundBrushItem()); - if(aBack.isUsed()) + if(aBack && aBack->isUsed()) { return false; } diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 5c33911727bf..8e7c4a3700ff 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -1977,7 +1977,7 @@ SwBorderAttrs::SwBorderAttrs(const SwModify *pMod, const SwFrame *pConstructor) , m_rUL(m_rAttrSet.GetULSpace()) // #i96772# // LRSpaceItem is copied due to the possibility that it is adjusted - see below - , m_rLR(m_rAttrSet.GetLRSpace()) + , m_rLR(static_cast<SvxLRSpaceItem*>(m_rAttrSet.GetLRSpace().Clone())) , m_rBox(m_rAttrSet.GetBox()) , m_rShadow(m_rAttrSet.GetShadow()) , m_aFrameSize(m_rAttrSet.GetFrameSize().GetSize()) @@ -2001,7 +2001,7 @@ SwBorderAttrs::SwBorderAttrs(const SwModify *pMod, const SwFrame *pConstructor) } else if ( pConstructor->IsNoTextFrame() ) { - m_rLR = SvxLRSpaceItem ( RES_LR_SPACE ); + m_rLR = std::make_shared<SvxLRSpaceItem>(RES_LR_SPACE); } // Caution: The USHORTs for the cached values are not initialized by intention! @@ -2054,9 +2054,9 @@ long SwBorderAttrs::CalcRight( const SwFrame* pCaller ) const } // for paragraphs, "left" is "before text" and "right" is "after text" if ( pCaller->IsTextFrame() && pCaller->IsRightToLeft() ) - nRight += m_rLR.GetLeft(); + nRight += m_rLR->GetLeft(); else - nRight += m_rLR.GetRight(); + nRight += m_rLR->GetRight(); // correction: retrieve left margin for numbering in R2L-layout if ( pCaller->IsTextFrame() && pCaller->IsRightToLeft() ) @@ -2103,7 +2103,7 @@ long SwBorderAttrs::CalcLeft( const SwFrame *pCaller ) const // for paragraphs, "left" is "before text" and "right" is "after text" if ( pCaller->IsTextFrame() && pCaller->IsRightToLeft() ) - nLeft += m_rLR.GetRight(); + nLeft += m_rLR->GetRight(); else { bool bIgnoreMargin = false; @@ -2121,7 +2121,7 @@ long SwBorderAttrs::CalcLeft( const SwFrame *pCaller ) const } } if (!bIgnoreMargin) - nLeft += m_rLR.GetLeft(); + nLeft += m_rLR->GetLeft(); } // correction: do not retrieve left margin for numbering in R2L-layout diff --git a/sw/source/core/layout/legacyitem.cxx b/sw/source/core/layout/legacyitem.cxx new file mode 100755 index 000000000000..9dea0dca8cf6 --- /dev/null +++ b/sw/source/core/layout/legacyitem.cxx @@ -0,0 +1,82 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <legacyitem.hxx> +#include <tools/stream.hxx> +#include <sal/log.hxx> +#include <fmtornt.hxx> + +namespace legacy +{ + namespace SwFormatVert + { + sal_uInt16 GetVersion(sal_uInt16) + { + return 0; + } + + void Create(SwFormatVertOrient& rItem, SvStream& rStrm, sal_uInt16 nVersionAbusedAsSize) + { + SwTwips yPos(0); + sal_Int16 orient(0); + sal_Int16 relation(0); + + switch (nVersionAbusedAsSize) + { + // compatibility hack for Table Auto Format: SwTwips is "long" :( + // (this means that the file format is platform dependent) + case 14: + { + sal_Int64 n(0); + rStrm.ReadInt64(n); + yPos = n; + break; + } + case 10: + { + sal_Int32 n(0); + rStrm.ReadInt32(n); + yPos = n; + break; + } + default: + SAL_WARN("sw.core", "SwFormatVertOrient::Create: unknown size"); + } + + rStrm.ReadInt16( orient ).ReadInt16( relation ); + + rItem.SetPos(yPos); + rItem.SetVertOrient(orient); + rItem.SetRelationOrient(relation); + } + + SvStream& Store(const SwFormatVertOrient& rItem, SvStream& rStrm, sal_uInt16) + { +#if SAL_TYPES_SIZEOFLONG == 8 + rStrm.WriteInt64(rItem.GetPos()); +#else + rStrm.WriteInt32(rItem.GetPos()); +#endif + rStrm.WriteInt16(rItem.GetVertOrient()).WriteInt16(rItem.GetRelationOrient()); + return rStrm; + } + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx index 2e3a122655e6..a0c7e08ee45b 100644 --- a/sw/source/core/layout/pagedesc.cxx +++ b/sw/source/core/layout/pagedesc.cxx @@ -159,7 +159,7 @@ void SwPageDesc::Mirror() aSet.Put( m_Master.GetPaperBin() ); aSet.Put( m_Master.GetULSpace() ); aSet.Put( m_Master.GetBox() ); - aSet.Put( m_Master.makeBackgroundBrushItem() ); + aSet.Put( *m_Master.makeBackgroundBrushItem() ); aSet.Put( m_Master.GetShadow() ); aSet.Put( m_Master.GetCol() ); aSet.Put( m_Master.GetFrameDir() ); diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index e8f0613cf942..ad7530657e4e 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -3920,13 +3920,14 @@ void SwFlyFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect const& } else { - SvxBrushItem aBack = GetFormat()->makeBackgroundBrushItem(); + std::shared_ptr<SvxBrushItem> aBack = GetFormat()->makeBackgroundBrushItem(); // OD 07.08.2002 #99657# #GetTransChg# // to determine, if background has to be painted, by checking, if // background color is not COL_TRANSPARENT ("no fill"/"auto fill") // or a background graphic exists. - bPaintCompleteBack = (aBack.GetColor() != COL_TRANSPARENT) || - aBack.GetGraphicPos() != GPOS_NONE; + bPaintCompleteBack = aBack && + ((aBack->GetColor() != COL_TRANSPARENT) || + aBack->GetGraphicPos() != GPOS_NONE); } } // paint of margin needed. diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 5c2158d415cb..060a8dcf6de3 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -3130,8 +3130,8 @@ SwTwips SwTabFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) InvalidatePage( pPage ); SetComplete(); - SvxBrushItem aBack = GetFormat()->makeBackgroundBrushItem(); - const SvxGraphicPosition ePos = aBack.GetGraphicPos(); + std::shared_ptr<SvxBrushItem> aBack = GetFormat()->makeBackgroundBrushItem(); + const SvxGraphicPosition ePos = aBack ? aBack->GetGraphicPos() : GPOS_NONE; if ( GPOS_NONE != ePos && GPOS_TILED != ePos ) SetCompletePaint(); } diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 0f486b4f3f4b..187f64e797a5 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -1678,8 +1678,8 @@ SwTwips SwFrame::AdjustNeighbourhood( SwTwips nDiff, bool bTst ) GetNext()->InvalidatePos_(); //Trigger a repaint if necessary. - SvxBrushItem aBack(pUp->GetFormat()->makeBackgroundBrushItem()); - const SvxGraphicPosition ePos = aBack.GetGraphicPos(); + std::shared_ptr<SvxBrushItem> aBack(pUp->GetFormat()->makeBackgroundBrushItem()); + const SvxGraphicPosition ePos = aBack ? aBack->GetGraphicPos() : GPOS_NONE; if ( ePos != GPOS_NONE && ePos != GPOS_TILED ) pViewShell->InvalidateWindows( pUp->getFrameArea() ); @@ -2717,8 +2717,8 @@ SwTwips SwLayoutFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) if( IsCellFrame() ) InvaPercentLowers( nReal ); - SvxBrushItem aBack(GetFormat()->makeBackgroundBrushItem()); - const SvxGraphicPosition ePos = aBack.GetGraphicPos(); + std::shared_ptr<SvxBrushItem> aBack(GetFormat()->makeBackgroundBrushItem()); + const SvxGraphicPosition ePos = aBack ? aBack->GetGraphicPos() : GPOS_NONE; if ( GPOS_NONE != ePos && GPOS_TILED != ePos ) SetCompletePaint(); } @@ -2903,8 +2903,8 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) const SwFrameFormat* pFormat = GetFormat(); if (pFormat) { - SvxBrushItem aBack(pFormat->makeBackgroundBrushItem()); - const SvxGraphicPosition ePos = aBack.GetGraphicPos(); + std::shared_ptr<SvxBrushItem> aBack(pFormat->makeBackgroundBrushItem()); + const SvxGraphicPosition ePos = aBack ? aBack->GetGraphicPos() : GPOS_NONE; if ( GPOS_NONE == ePos || GPOS_TILED == ePos ) bCompletePaint = false; } diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx index bfb547d31487..760a0a8774bf 100644 --- a/sw/source/core/text/porfld.cxx +++ b/sw/source/core/text/porfld.cxx @@ -765,7 +765,7 @@ SwGrfNumPortion::SwGrfNumPortion( m_bReplace = false; if( pGrfBrush ) { - *pBrush = *pGrfBrush; + pBrush.reset(static_cast<SvxBrushItem*>(pGrfBrush->Clone())); const Graphic* pGraph = pGrfBrush->GetGraphic(); if( pGraph ) SetAnimated( pGraph->IsAnimated() ); diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index c044b4903112..ff94c1848b1b 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -3289,7 +3289,7 @@ SwTwips SwTextNode::GetAdditionalIndentForStartingNewList() const } // #i96772# -void SwTextNode::ClearLRSpaceItemDueToListLevelIndents( SvxLRSpaceItem& o_rLRSpaceItem ) const +void SwTextNode::ClearLRSpaceItemDueToListLevelIndents( std::shared_ptr<SvxLRSpaceItem>& o_rLRSpaceItem ) const { if ( AreListLevelIndentsApplicable() ) { @@ -3299,8 +3299,7 @@ void SwTextNode::ClearLRSpaceItemDueToListLevelIndents( SvxLRSpaceItem& o_rLRSpa const SwNumFormat& rFormat = pRule->Get(lcl_BoundListLevel(GetActualListLevel())); if ( rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) { - SvxLRSpaceItem aLR( RES_LR_SPACE ); - o_rLRSpaceItem = aLR; + o_rLRSpaceItem = std::make_shared<SvxLRSpaceItem>(RES_LR_SPACE); } } } diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index dc6db2ab7438..d5dfc5681fb6 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -355,7 +355,7 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI if(bXFillStyleItemUsed) { XFillStyleItem aXFillStyleItem; - SvxBrushItem aBrush(RES_BACKGROUND); + std::shared_ptr<SvxBrushItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND)); if(pXFillStyleItem) { @@ -379,10 +379,10 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI // Fill style is set to solid, but no fill color is given. // On the other hand, we have a BackColor, so use that. if (pCol) - aBrush.PutValue(*pCol, MID_BACK_COLOR); + aBrush->PutValue(*pCol, MID_BACK_COLOR); else - aBrush.PutValue(*pRGBCol, MID_BACK_COLOR_R_G_B); - setSvxBrushItemAsFillAttributesToTargetSet(aBrush, rToSet); + aBrush->PutValue(*pRGBCol, MID_BACK_COLOR_R_G_B); + setSvxBrushItemAsFillAttributesToTargetSet(*aBrush, rToSet); } if(pXFillGradientItem || pXFillGradientNameItem) @@ -490,8 +490,8 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI } if (aXFillStyleItem.GetValue() == drawing::FillStyle_SOLID) { - aBrush.PutValue(*pColTrans, MID_BACK_COLOR_TRANSPARENCY); - setSvxBrushItemAsFillAttributesToTargetSet(aBrush, rToSet); + aBrush->PutValue(*pColTrans, MID_BACK_COLOR_TRANSPARENCY); + setSvxBrushItemAsFillAttributesToTargetSet(*aBrush, rToSet); } } @@ -1767,14 +1767,14 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any& if(RES_BACKGROUND == pEntry->nWID) { const SwAttrSet& rSet = pFormat->GetAttrSet(); - const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND, true, pDoc->IsInXMLImport())); - SvxBrushItem aChangedBrushItem(aOriginalBrushItem); + const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND, true, pDoc->IsInXMLImport())); + std::shared_ptr<SvxBrushItem> aChangedBrushItem(static_cast<SvxBrushItem*>(aOriginalBrushItem->Clone())); - aChangedBrushItem.PutValue(aValue, nMemberId); + aChangedBrushItem->PutValue(aValue, nMemberId); - if(aChangedBrushItem != aOriginalBrushItem) + if(*aChangedBrushItem != *aOriginalBrushItem) { - setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, aSet); + setSvxBrushItemAsFillAttributesToTargetSet(*aChangedBrushItem, aSet); pFormat->GetDoc()->SetFlyFrameAttr( *pFormat, aSet ); } @@ -2217,9 +2217,9 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName) if(RES_BACKGROUND == pEntry->nWID) { - const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND)); + const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND)); - if(!aOriginalBrushItem.QueryValue(aAny, nMemberId)) + if(!aOriginalBrushItem->QueryValue(aAny, nMemberId)) { OSL_ENSURE(false, "Error getting attribute from RES_BACKGROUND (!)"); } diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx index bf9abc3bf68c..2e1201675697 100644 --- a/sw/source/core/unocore/unoparagraph.cxx +++ b/sw/source/core/unocore/unoparagraph.cxx @@ -450,9 +450,9 @@ void SwXParagraph::Impl::GetSinglePropertyValue_Impl( { case RES_BACKGROUND: { - const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND)); + const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND)); - if(!aOriginalBrushItem.QueryValue(rAny, rEntry.nMemberId)) + if(!aOriginalBrushItem->QueryValue(rAny, rEntry.nMemberId)) { OSL_ENSURE(false, "Error getting attribute from RES_BACKGROUND (!)"); } diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 2dfc44ef08c3..56f991b53364 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -1647,20 +1647,20 @@ template<> void SwXStyle::SetPropertyValue<sal_uInt16(RES_BACKGROUND)>(const SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase) { SfxItemSet& rStyleSet = o_rStyleBase.GetItemSet(); - const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet, RES_BACKGROUND, true, m_pDoc->IsInXMLImport())); - SvxBrushItem aChangedBrushItem(aOriginalBrushItem); + const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet, RES_BACKGROUND, true, m_pDoc->IsInXMLImport())); + std::shared_ptr<SvxBrushItem> aChangedBrushItem(static_cast<SvxBrushItem*>(aOriginalBrushItem->Clone())); uno::Any aValue(rValue); const auto nMemberId(lcl_TranslateMetric(rEntry, m_pDoc, aValue)); - aChangedBrushItem.PutValue(aValue, nMemberId); + aChangedBrushItem->PutValue(aValue, nMemberId); // 0xff is already the default - but if BackTransparent is set // to true, it must be applied in the item set on ODF import // to potentially override parent style, which is unknown yet - if(aChangedBrushItem == aOriginalBrushItem && (MID_GRAPHIC_TRANSPARENT != nMemberId || !aValue.has<bool>() || !aValue.get<bool>())) + if(*aChangedBrushItem == *aOriginalBrushItem && (MID_GRAPHIC_TRANSPARENT != nMemberId || !aValue.has<bool>() || !aValue.get<bool>())) return; - setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, rStyleSet); + setSvxBrushItemAsFillAttributesToTargetSet(*aChangedBrushItem, rStyleSet); } template<> void SwXStyle::SetPropertyValue<OWN_ATTR_FILLBMP_MODE>(const SfxItemPropertySimpleEntry&, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase) @@ -2281,9 +2281,9 @@ uno::Any SwXStyle::GetStyleProperty<sal_uInt16(RES_BACKGROUND)>(const SfxItemPro { PrepareStyleBase(rBase); const SfxItemSet& rSet = rBase.GetItemSet(); - const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND)); + const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND)); uno::Any aResult; - if(!aOriginalBrushItem.QueryValue(aResult, rEntry.nMemberId)) + if(!aOriginalBrushItem->QueryValue(aResult, rEntry.nMemberId)) SAL_WARN("sw.uno", "error getting attribute from RES_BACKGROUND."); return aResult; } @@ -2682,7 +2682,7 @@ void SAL_CALL SwXStyle::setAllPropertiesToDefault() pPageFormat->SetFormatAttr(aLR); pPageFormat->SetFormatAttr(aUL); SwPageDesc* pStdPgDsc = m_pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD); - SwFormatFrameSize aFrameSz(ATT_FIX_SIZE); + std::shared_ptr<SwFormatFrameSize> aFrameSz(std::make_shared<SwFormatFrameSize>(ATT_FIX_SIZE)); if(RES_POOLPAGE_STANDARD == rPageDesc.GetPoolFormatId()) { @@ -2690,27 +2690,27 @@ void SAL_CALL SwXStyle::setAllPropertiesToDefault() { const Size aPhysSize( SvxPaperInfo::GetPaperSize( static_cast<Printer*>(m_pDoc->getIDocumentDeviceAccess().getPrinter(false)))); - aFrameSz.SetSize(aPhysSize); + aFrameSz->SetSize(aPhysSize); } else { - aFrameSz.SetSize(SvxPaperInfo::GetDefaultPaperSize()); + aFrameSz->SetSize(SvxPaperInfo::GetDefaultPaperSize()); } } else { - aFrameSz = pStdPgDsc->GetMaster().GetFrameSize(); + aFrameSz.reset(static_cast<SwFormatFrameSize*>(pStdPgDsc->GetMaster().GetFrameSize().Clone())); } if(pStdPgDsc->GetLandscape()) { - SwTwips nTmp = aFrameSz.GetHeight(); - aFrameSz.SetHeight(aFrameSz.GetWidth()); - aFrameSz.SetWidth(nTmp); + SwTwips nTmp = aFrameSz->GetHeight(); + aFrameSz->SetHeight(aFrameSz->GetWidth()); + aFrameSz->SetWidth(nTmp); } - pPageFormat->SetFormatAttr(aFrameSz); + pPageFormat->SetFormatAttr(*aFrameSz); m_pDoc->ChgPageDesc(nPgDscPos, m_pDoc->GetPageDesc(nPgDscPos)); return; } @@ -3641,14 +3641,14 @@ uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle( } case RES_BACKGROUND: { - const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND, true, m_pDocShell->GetDoc()->IsInXMLImport())); - SvxBrushItem aChangedBrushItem(aOriginalBrushItem); + const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND, true, m_pDocShell->GetDoc()->IsInXMLImport())); + std::shared_ptr<SvxBrushItem> aChangedBrushItem(static_cast<SvxBrushItem*>(aOriginalBrushItem->Clone())); - aChangedBrushItem.PutValue(aValue, nMemberId); + aChangedBrushItem->PutValue(aValue, nMemberId); - if(aChangedBrushItem != aOriginalBrushItem) + if(*aChangedBrushItem != *aOriginalBrushItem) { - setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, aSet); + setSvxBrushItemAsFillAttributesToTargetSet(*aChangedBrushItem, aSet); } bDone = true; @@ -3969,9 +3969,9 @@ uno::Sequence< uno::Any > SwXAutoStyle::GetPropertyValues_Impl( { case RES_BACKGROUND: { - const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(*mpSet, RES_BACKGROUND)); + const std::shared_ptr<SvxBrushItem> aOriginalBrushItem(getSvxBrushItemFromSourceSet(*mpSet, RES_BACKGROUND)); - if(!aOriginalBrushItem.QueryValue(aTarget, pEntry->nMemberId)) + if(!aOriginalBrushItem->QueryValue(aTarget, pEntry->nMemberId)) { OSL_ENSURE(false, "Error getting attribute from RES_BACKGROUND (!)"); } diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 26f6dab13353..6843d98d75cd 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -1674,10 +1674,10 @@ void SwXTextTableCursor::setPropertyValue(const OUString& rPropertyName, const u { case FN_UNO_TABLE_CELL_BACKGROUND: { - SvxBrushItem aBrush(RES_BACKGROUND); + std::shared_ptr<SfxPoolItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND)); SwDoc::GetBoxAttr(rUnoCursor, aBrush); - aBrush.PutValue(aValue, pEntry->nMemberId); - pDoc->SetBoxAttr(rUnoCursor, aBrush); + aBrush->PutValue(aValue, pEntry->nMemberId); + pDoc->SetBoxAttr(rUnoCursor, *aBrush); } break; @@ -1727,9 +1727,9 @@ uno::Any SwXTextTableCursor::getPropertyValue(const OUString& rPropertyName) { case FN_UNO_TABLE_CELL_BACKGROUND: { - SvxBrushItem aBrush(RES_BACKGROUND); + std::shared_ptr<SfxPoolItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND)); if (SwDoc::GetBoxAttr(rUnoCursor, aBrush)) - aBrush.QueryValue(aResult, pEntry->nMemberId); + aBrush->QueryValue(aResult, pEntry->nMemberId); } break; case RES_BOXATR_FORMAT: @@ -1814,8 +1814,8 @@ void SwTableProperties_Impl::AddItemToSet(SfxItemSet& rSet, std::function<Tpooli { Tpoolitem aItem = aItemFactory(); for(auto& aMemberAndAny : vMemberAndAny) - aItem.PutValue(*aMemberAndAny.second, aMemberAndAny.first | (bAddTwips ? CONVERT_TWIPS : 0) ); - rSet.Put(aItem); + aItem->PutValue(*aMemberAndAny.second, aMemberAndAny.first | (bAddTwips ? CONVERT_TWIPS : 0) ); + rSet.Put(*aItem); } } void SwTableProperties_Impl::ApplyTableAttr(const SwTable& rTable, SwDoc& rDoc) @@ -1837,7 +1837,7 @@ void SwTableProperties_Impl::ApplyTableAttr(const SwTable& rTable, SwDoc& rDoc) const_cast<SwTable&>(rTable).SetRowsToRepeat( bVal ? 1 : 0 ); // TODO: MULTIHEADER } - AddItemToSet<SvxBrushItem>(aSet, [&rFrameFormat]() { return rFrameFormat.makeBackgroundBrushItem(); }, RES_BACKGROUND, { + AddItemToSet<std::shared_ptr<SvxBrushItem>>(aSet, [&rFrameFormat]() { return rFrameFormat.makeBackgroundBrushItem(); }, RES_BACKGROUND, { MID_BACK_COLOR, MID_GRAPHIC_TRANSPARENT, MID_GRAPHIC_POSITION, @@ -1869,10 +1869,10 @@ void SwTableProperties_Impl::ApplyTableAttr(const SwTable& rTable, SwDoc& rDoc) } if(bPutBreak) - AddItemToSet<SvxFormatBreakItem>(aSet, [&rFrameFormat]() { return rFrameFormat.GetBreak(); }, RES_BREAK, {0}); - AddItemToSet<SvxShadowItem>(aSet, [&rFrameFormat]() { return rFrameFormat.GetShadow(); }, RES_SHADOW, {0}, true); - AddItemToSet<SvxFormatKeepItem>(aSet, [&rFrameFormat]() { return rFrameFormat.GetKeep(); }, RES_KEEP, {0}); - AddItemToSet<SwFormatHoriOrient>(aSet, [&rFrameFormat]() { return rFrameFormat.GetHoriOrient(); }, RES_HORI_ORIENT, {MID_HORIORIENT_ORIENT}, true); + AddItemToSet<std::shared_ptr<SvxFormatBreakItem>>(aSet, [&rFrameFormat]() { return std::shared_ptr<SvxFormatBreakItem>(static_cast<SvxFormatBreakItem*>(rFrameFormat.GetBreak().Clone())); }, RES_BREAK, {0}); + AddItemToSet<std::shared_ptr<SvxShadowItem>>(aSet, [&rFrameFormat]() { return std::shared_ptr<SvxShadowItem>(static_cast<SvxShadowItem*>(rFrameFormat.GetShadow().Clone())); }, RES_SHADOW, {0}, true); + AddItemToSet<std::shared_ptr<SvxFormatKeepItem>>(aSet, [&rFrameFormat]() { return std::shared_ptr<SvxFormatKeepItem>(static_cast<SvxFormatKeepItem*>(rFrameFormat.GetKeep().Clone())); }, RES_KEEP, {0}); + AddItemToSet<std::shared_ptr<SwFormatHoriOrient>>(aSet, [&rFrameFormat]() { return std::shared_ptr<SwFormatHoriOrient>(static_cast<SwFormatHoriOrient*>(rFrameFormat.GetHoriOrient().Clone())); }, RES_HORI_ORIENT, {MID_HORIORIENT_ORIENT}, true); const uno::Any* pSzRel(nullptr); GetProperty(FN_TABLE_IS_RELATIVE_WIDTH, 0xff, pSzRel); @@ -1899,10 +1899,10 @@ void SwTableProperties_Impl::ApplyTableAttr(const SwTable& rTable, SwDoc& rDoc) aSz.SetWidth(MINLAY); aSet.Put(aSz); } - AddItemToSet<SvxLRSpaceItem>(aSet, [&rFrameFormat]() { return rFrameFormat.GetLRSpace(); }, RES_LR_SPACE, { + AddItemToSet<std::shared_ptr<SvxLRSpaceItem>>(aSet, [&rFrameFormat]() { return std::shared_ptr<SvxLRSpaceItem>(static_cast<SvxLRSpaceItem*>(rFrameFormat.GetLRSpace().Clone())); }, RES_LR_SPACE, { MID_L_MARGIN|CONVERT_TWIPS, MID_R_MARGIN|CONVERT_TWIPS }); - AddItemToSet<SvxULSpaceItem>(aSet, [&rFrameFormat]() { return rFrameFormat.GetULSpace(); }, RES_UL_SPACE, { + AddItemToSet<std::shared_ptr<SvxULSpaceItem>>(aSet, [&rFrameFormat]() { return std::shared_ptr<SvxULSpaceItem>(static_cast<SvxULSpaceItem*>(rFrameFormat.GetULSpace().Clone())); }, RES_UL_SPACE, { MID_UP_MARGIN|CONVERT_TWIPS, MID_LO_MARGIN|CONVERT_TWIPS }); const::uno::Any* pSplit(nullptr); @@ -3397,10 +3397,10 @@ SwXCellRange::setPropertyValue(const OUString& rPropertyName, const uno::Any& aV { case FN_UNO_TABLE_CELL_BACKGROUND: { - SvxBrushItem aBrush( RES_BACKGROUND ); + std::shared_ptr<SfxPoolItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND)); SwDoc::GetBoxAttr(*m_pImpl->m_pTableCursor, aBrush); - static_cast<SfxPoolItem&>(aBrush).PutValue(aValue, pEntry->nMemberId); - pDoc->SetBoxAttr(*m_pImpl->m_pTableCursor, aBrush); + aBrush->PutValue(aValue, pEntry->nMemberId); + pDoc->SetBoxAttr(*m_pImpl->m_pTableCursor, *aBrush); } break; @@ -3507,9 +3507,9 @@ uno::Any SAL_CALL SwXCellRange::getPropertyValue(const OUString& rPropertyName) { case FN_UNO_TABLE_CELL_BACKGROUND: { - SvxBrushItem aBrush( RES_BACKGROUND ); + std::shared_ptr<SfxPoolItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND)); if (SwDoc::GetBoxAttr(*m_pImpl->m_pTableCursor, aBrush)) - aBrush.QueryValue(aRet, pEntry->nMemberId); + aBrush->QueryValue(aRet, pEntry->nMemberId); } break; @@ -3546,10 +3546,10 @@ uno::Any SAL_CALL SwXCellRange::getPropertyValue(const OUString& rPropertyName) break; case RES_VERT_ORIENT: { - SwFormatVertOrient aVertOrient; + std::shared_ptr<SfxPoolItem> aVertOrient; if (SwDoc::GetBoxAttr(*m_pImpl->m_pTableCursor, aVertOrient)) { - aVertOrient.QueryValue( aRet, pEntry->nMemberId ); + aVertOrient->QueryValue( aRet, pEntry->nMemberId ); } } break; diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx index 18de2e807c64..3b6ce6e54469 100644 --- a/sw/source/filter/basflt/fltini.cxx +++ b/sw/source/filter/basflt/fltini.cxx @@ -308,9 +308,9 @@ void CalculateFlySize(SfxItemSet& rFlySet, const SwNodeIndex& rAnchor, if( SfxItemState::SET != rFlySet.GetItemState( RES_FRM_SIZE, true, &pItem ) || MINFLY > static_cast<const SwFormatFrameSize*>(pItem)->GetWidth() ) { - SwFormatFrameSize aSz(rFlySet.Get(RES_FRM_SIZE)); + std::shared_ptr<SwFormatFrameSize> aSz(static_cast<SwFormatFrameSize*>(rFlySet.Get(RES_FRM_SIZE).Clone())); if (pItem) - aSz = static_cast<const SwFormatFrameSize&>(*pItem); + aSz.reset(static_cast<SwFormatFrameSize*>(pItem->Clone())); SwTwips nWidth; // determine the width; if there is a table use the width of the table; @@ -397,16 +397,16 @@ void CalculateFlySize(SfxItemSet& rFlySet, const SwNodeIndex& rAnchor, if( MINFLY > nWidth ) nWidth = MINFLY; - aSz.SetWidth( nWidth ); - if( MINFLY > aSz.GetHeight() ) - aSz.SetHeight( MINFLY ); - rFlySet.Put( aSz ); + aSz->SetWidth( nWidth ); + if( MINFLY > aSz->GetHeight() ) + aSz->SetHeight( MINFLY ); + rFlySet.Put( *aSz ); } else if( MINFLY > static_cast<const SwFormatFrameSize*>(pItem)->GetHeight() ) { - SwFormatFrameSize aSz( *static_cast<const SwFormatFrameSize*>(pItem) ); - aSz.SetHeight( MINFLY ); - rFlySet.Put( aSz ); + std::shared_ptr<SwFormatFrameSize> aSz(static_cast<SwFormatFrameSize*>(pItem->Clone())); + aSz->SetHeight( MINFLY ); + rFlySet.Put( *aSz ); } } diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index dd6f6564a4f6..53fe8ef3c76e 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -2153,7 +2153,7 @@ static bool OutCSS1_FrameFormatBrush( SwHTMLWriter& rWrt, void SwHTMLWriter::OutCSS1_FrameFormatBackground( const SwFrameFormat& rFrameFormat ) { // If the frame itself has a background, then export. - if( OutCSS1_FrameFormatBrush( *this, rFrameFormat.makeBackgroundBrushItem() ) ) + if( OutCSS1_FrameFormatBrush( *this, *rFrameFormat.makeBackgroundBrushItem() ) ) return; // If the frame is not linked to a page, we use the background of the anchor. @@ -2181,7 +2181,7 @@ void SwHTMLWriter::OutCSS1_FrameFormatBackground( const SwFrameFormat& rFrameFor // If the box has a background, we take it. if( OutCSS1_FrameFormatBrush( *this, - pBox->GetFrameFormat()->makeBackgroundBrushItem() ) ) + *pBox->GetFrameFormat()->makeBackgroundBrushItem() ) ) return; // Otherwise we use that of the lines @@ -2189,7 +2189,7 @@ void SwHTMLWriter::OutCSS1_FrameFormatBackground( const SwFrameFormat& rFrameFor while( pLine ) { if( OutCSS1_FrameFormatBrush( *this, - pLine->GetFrameFormat()->makeBackgroundBrushItem() ) ) + *pLine->GetFrameFormat()->makeBackgroundBrushItem() ) ) return; pBox = pLine->GetUpper(); pLine = pBox ? pBox->GetUpper() : nullptr; @@ -2197,7 +2197,7 @@ void SwHTMLWriter::OutCSS1_FrameFormatBackground( const SwFrameFormat& rFrameFor // If there was none either, we use the background of the table. if( OutCSS1_FrameFormatBrush( *this, - pTableNd->GetTable().GetFrameFormat()->makeBackgroundBrushItem() ) ) + *pTableNd->GetTable().GetFrameFormat()->makeBackgroundBrushItem() ) ) return; } @@ -2216,7 +2216,7 @@ void SwHTMLWriter::OutCSS1_FrameFormatBackground( const SwFrameFormat& rFrameFor // the value of the Config. OSL_ENSURE( m_pCurrPageDesc, "no page template found" ); if( !OutCSS1_FrameFormatBrush( *this, - m_pCurrPageDesc->GetMaster().makeBackgroundBrushItem() ) ) + *m_pCurrPageDesc->GetMaster().makeBackgroundBrushItem() ) ) { Color aColor( COL_WHITE ); diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx index c08bd868b084..8ff8ab08d378 100644 --- a/sw/source/filter/html/htmlcss1.cxx +++ b/sw/source/filter/html/htmlcss1.cxx @@ -377,12 +377,12 @@ void SwCSS1Parser::SetTableTextColl( bool bHeader ) void SwCSS1Parser::SetPageDescAttrs( const SvxBrushItem *pBrush, SfxItemSet *pItemSet2 ) { - SvxBrushItem aBrushItem( RES_BACKGROUND ); - SvxBoxItem aBoxItem( RES_BOX ); - SvxFrameDirectionItem aFrameDirItem(SvxFrameDirection::Environment, RES_FRAMEDIR); + std::shared_ptr<SvxBrushItem> aBrushItem(std::make_shared<SvxBrushItem>(RES_BACKGROUND)); + std::shared_ptr<SvxBoxItem> aBoxItem(std::make_shared<SvxBoxItem>(RES_BOX)); + std::shared_ptr<SvxFrameDirectionItem> aFrameDirItem(std::make_shared<SvxFrameDirectionItem>(SvxFrameDirection::Environment, RES_FRAMEDIR)); bool bSetBrush = pBrush!=nullptr, bSetBox = false, bSetFrameDir = false; if( pBrush ) - aBrushItem = *pBrush; + aBrushItem.reset(static_cast<SvxBrushItem*>(pBrush->Clone())); if( pItemSet2 ) { @@ -391,7 +391,7 @@ void SwCSS1Parser::SetPageDescAttrs( const SvxBrushItem *pBrush, &pItem ) ) { // set a background - aBrushItem = *static_cast<const SvxBrushItem *>(pItem); + aBrushItem.reset(static_cast<SvxBrushItem*>(pItem->Clone())); pItemSet2->ClearItem( RES_BACKGROUND ); bSetBrush = true; } @@ -399,7 +399,7 @@ void SwCSS1Parser::SetPageDescAttrs( const SvxBrushItem *pBrush, if( SfxItemState::SET == pItemSet2->GetItemState( RES_BOX, false, &pItem ) ) { // set a border - aBoxItem = *static_cast<const SvxBoxItem *>(pItem); + aBoxItem.reset(static_cast<SvxBoxItem*>(pItem->Clone())); pItemSet2->ClearItem( RES_BOX ); bSetBox = true; } @@ -407,7 +407,7 @@ void SwCSS1Parser::SetPageDescAttrs( const SvxBrushItem *pBrush, if( SfxItemState::SET == pItemSet2->GetItemState( RES_FRAMEDIR, false, &pItem ) ) { // set a frame - aFrameDirItem = *static_cast< const SvxFrameDirectionItem *>( pItem ); + aFrameDirItem.reset(static_cast<SvxFrameDirectionItem*>(pItem->Clone())); pItemSet2->ClearItem( RES_FRAMEDIR ); bSetFrameDir = true; } @@ -425,11 +425,11 @@ void SwCSS1Parser::SetPageDescAttrs( const SvxBrushItem *pBrush, SwPageDesc aNewPageDesc( *pPageDesc ); SwFrameFormat &rMaster = aNewPageDesc.GetMaster(); if( bSetBrush ) - rMaster.SetFormatAttr( aBrushItem ); + rMaster.SetFormatAttr( *aBrushItem ); if( bSetBox ) - rMaster.SetFormatAttr( aBoxItem ); + rMaster.SetFormatAttr( *aBoxItem ); if( bSetFrameDir ) - rMaster.SetFormatAttr( aFrameDirItem ); + rMaster.SetFormatAttr( *aFrameDirItem ); ChgPageDesc( pPageDesc, aNewPageDesc ); } @@ -546,7 +546,7 @@ void SwCSS1Parser::SetPageDescAttrs( const SwPageDesc *pPageDesc, ChgPageDesc( pPageDesc, aNewPageDesc ); } -SvxBrushItem SwCSS1Parser::makePageDescBackground() const +std::shared_ptr<SvxBrushItem> SwCSS1Parser::makePageDescBackground() const { return m_pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool( RES_POOLPAGE_HTML, false ) ->GetMaster().makeBackgroundBrushItem(); diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index 54051a63b8bf..6eca6c22fb7c 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -261,12 +261,15 @@ sal_uInt16 SwHTMLWriter::GuessFrameType( const SwFrameFormat& rFrameFormat, } if( bEmpty ) { - SvxBrushItem aBrush = rFrameFormat.makeBackgroundBrushItem(); + std::shared_ptr<SvxBrushItem> aBrush = rFrameFormat.makeBackgroundBrushItem(); /// background is not empty, if it has a background graphic /// or its background color is not "no fill"/"auto fill". - if( GPOS_NONE != aBrush.GetGraphicPos() || - aBrush.GetColor() != COL_TRANSPARENT ) + if( aBrush && + (GPOS_NONE != aBrush->GetGraphicPos() || + aBrush->GetColor() != COL_TRANSPARENT )) + { bEmpty = false; + } } if( bEmpty ) { diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index 605ba1dfea2b..b0c6fd24e66f 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -1003,23 +1003,23 @@ void SwHTMLParser::InsertBodyOptions() // Prepare the items for the page style (background, frame) // If BrushItem already set values must remain! - SvxBrushItem aBrushItem( m_pCSS1Parser->makePageDescBackground() ); + std::shared_ptr<SvxBrushItem> aBrushItem( m_pCSS1Parser->makePageDescBackground() ); bool bSetBrush = false; if( bBGColor && !m_pCSS1Parser->IsBodyBGColorSet() ) { // background colour from "BGCOLOR" OUString aLink; - if( !aBrushItem.GetGraphicLink().isEmpty() ) - aLink = aBrushItem.GetGraphicLink(); - SvxGraphicPosition ePos = aBrushItem.GetGraphicPos(); + if( !aBrushItem->GetGraphicLink().isEmpty() ) + aLink = aBrushItem->GetGraphicLink(); + SvxGraphicPosition ePos = aBrushItem->GetGraphicPos(); - aBrushItem.SetColor( aBGColor ); + aBrushItem->SetColor( aBGColor ); if( !aLink.isEmpty() ) { - aBrushItem.SetGraphicLink( aLink ); - aBrushItem.SetGraphicPos( ePos ); + aBrushItem->SetGraphicLink( aLink ); + aBrushItem->SetGraphicPos( ePos ); } bSetBrush = true; m_pCSS1Parser->SetBodyBGColorSet(); @@ -1028,8 +1028,8 @@ void SwHTMLParser::InsertBodyOptions() if( !aBackGround.isEmpty() && !m_pCSS1Parser->IsBodyBackgroundSet() ) { // background graphic from "BACKGROUND" - aBrushItem.SetGraphicLink( INetURLObject::GetAbsURL( m_sBaseURL, aBackGround ) ); - aBrushItem.SetGraphicPos( GPOS_TILED ); + aBrushItem->SetGraphicLink( INetURLObject::GetAbsURL( m_sBaseURL, aBackGround ) ); + aBrushItem->SetGraphicPos( GPOS_TILED ); bSetBrush = true; m_pCSS1Parser->SetBodyBackgroundSet(); } @@ -1043,7 +1043,7 @@ void SwHTMLParser::InsertBodyOptions() // Some attributes have to set on the page style, in fact the ones // which aren't inherited - m_pCSS1Parser->SetPageDescAttrs( bSetBrush ? &aBrushItem : nullptr, + m_pCSS1Parser->SetPageDescAttrs( bSetBrush ? aBrushItem.get() : nullptr, &aItemSet ); const SfxPoolItem *pItem; @@ -1070,7 +1070,7 @@ void SwHTMLParser::InsertBodyOptions() } else if( bSetBrush ) { - m_pCSS1Parser->SetPageDescAttrs( &aBrushItem ); + m_pCSS1Parser->SetPageDescAttrs( aBrushItem.get() ); } if( bLinkColor && !m_pCSS1Parser->IsBodyLinkSet() ) diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx index 66261bbbc1bf..44ea0cfefd61 100644 --- a/sw/source/filter/html/htmltabw.cxx +++ b/sw/source/filter/html/htmltabw.cxx @@ -135,13 +135,13 @@ bool SwHTMLWrtTable::HasTabBackground( const SwTableBox& rBox, bool bRet = false; if( rBox.GetSttNd() ) { - SvxBrushItem aBrushItem = + std::shared_ptr<SvxBrushItem> aBrushItem = rBox.GetFrameFormat()->makeBackgroundBrushItem(); /// The table box has a background, if its background color is not "no fill"/ /// "auto fill" or it has a background graphic. - bRet = aBrushItem.GetColor() != COL_TRANSPARENT || - !aBrushItem.GetGraphicLink().isEmpty() || aBrushItem.GetGraphic(); + bRet = aBrushItem && (aBrushItem->GetColor() != COL_TRANSPARENT || + !aBrushItem->GetGraphicLink().isEmpty() || aBrushItem->GetGraphic()); } else { @@ -166,11 +166,11 @@ bool SwHTMLWrtTable::HasTabBackground( const SwTableLine& rLine, OSL_ENSURE( bTop || bBottom || bLeft || bRight, "HasTabBackground: cannot be called" ); - SvxBrushItem aBrushItem = rLine.GetFrameFormat()->makeBackgroundBrushItem(); + std::shared_ptr<SvxBrushItem> aBrushItem = rLine.GetFrameFormat()->makeBackgroundBrushItem(); /// The table line has a background, if its background color is not "no fill"/ /// "auto fill" or it has a background graphic. - bool bRet = aBrushItem.GetColor() != COL_TRANSPARENT || - !aBrushItem.GetGraphicLink().isEmpty() || aBrushItem.GetGraphic(); + bool bRet = aBrushItem && (aBrushItem->GetColor() != COL_TRANSPARENT || + !aBrushItem->GetGraphicLink().isEmpty() || aBrushItem->GetGraphic()); if( !bRet ) { diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx index 8f8491b015cd..11aba0a854c8 100644 --- a/sw/source/filter/html/svxcss1.cxx +++ b/sw/source/filter/html/svxcss1.cxx @@ -587,25 +587,25 @@ void SvxCSS1PropertyInfo::SetBoxItem( SfxItemSet& rItemSet, if( !bChg ) return; - SvxBoxItem aBoxItem( aItemIds.nBox ); + std::shared_ptr<SvxBoxItem> aBoxItem(std::make_shared<SvxBoxItem>(aItemIds.nBox)); if( pDfltItem ) - aBoxItem = *pDfltItem; + aBoxItem.reset(static_cast<SvxBoxItem*>(pDfltItem->Clone())); SvxCSS1BorderInfo *pInfo = GetBorderInfo( SvxBoxItemLine::TOP, false ); if( pInfo ) - pInfo->SetBorderLine( SvxBoxItemLine::TOP, aBoxItem ); + pInfo->SetBorderLine( SvxBoxItemLine::TOP, *aBoxItem ); pInfo = GetBorderInfo( SvxBoxItemLine::BOTTOM, false ); if( pInfo ) - pInfo->SetBorderLine( SvxBoxItemLine::BOTTOM, aBoxItem ); + pInfo->SetBorderLine( SvxBoxItemLine::BOTTOM, *aBoxItem ); pInfo = GetBorderInfo( SvxBoxItemLine::LEFT, false ); if( pInfo ) - pInfo->SetBorderLine( SvxBoxItemLine::LEFT, aBoxItem ); + pInfo->SetBorderLine( SvxBoxItemLine::LEFT, *aBoxItem ); pInfo = GetBorderInfo( SvxBoxItemLine::RIGHT, false ); if( pInfo ) - pInfo->SetBorderLine( SvxBoxItemLine::RIGHT, aBoxItem ); + pInfo->SetBorderLine( SvxBoxItemLine::RIGHT, *aBoxItem ); for( size_t i=0; i<m_aBorderInfos.size(); ++i ) { @@ -631,10 +631,10 @@ void SvxCSS1PropertyInfo::SetBoxItem( SfxItemSet& rItemSet, break; } - if( aBoxItem.GetLine( nLine ) ) + if( aBoxItem->GetLine( nLine ) ) { if( UNSET_BORDER_DISTANCE == nDist ) - nDist = aBoxItem.GetDistance( nLine ); + nDist = aBoxItem->GetDistance( nLine ); if( nDist < nMinBorderDist ) nDist = nMinBorderDist; @@ -644,10 +644,10 @@ void SvxCSS1PropertyInfo::SetBoxItem( SfxItemSet& rItemSet, nDist = 0U; } - aBoxItem.SetDistance( nDist, nLine ); + aBoxItem->SetDistance( nDist, nLine ); } - rItemSet.Put( aBoxItem ); + rItemSet.Put( *aBoxItem ); DestroyBorderInfos(); } diff --git a/sw/source/filter/html/swcss1.hxx b/sw/source/filter/html/swcss1.hxx index d99e9c696f68..b368bd1f068e 100644 --- a/sw/source/filter/html/swcss1.hxx +++ b/sw/source/filter/html/swcss1.hxx @@ -145,7 +145,7 @@ public: void SetBodyLinkSet() { m_bBodyLinkSet = true; } void SetBodyVLinkSet() { m_bBodyVLinkSet = true; } - SvxBrushItem makePageDescBackground() const; + std::shared_ptr<SvxBrushItem> makePageDescBackground() const; inline void SetTHTagStyles(); inline void SetTDTagStyles(); diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 9f3a9d335b11..3a165f897102 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -5150,7 +5150,7 @@ void SwHTMLParser::InsertLineBreak() } // parse styles - SvxFormatBreakItem aBreakItem( SvxBreak::NONE, RES_BREAK ); + std::shared_ptr<SvxFormatBreakItem> aBreakItem(std::make_shared<SvxFormatBreakItem>(SvxBreak::NONE, RES_BREAK)); bool bBreakItem = false; if( HasStyleOptions( aStyle, aId, aClass ) ) { @@ -5161,7 +5161,7 @@ void SwHTMLParser::InsertLineBreak() { if( m_pCSS1Parser->SetFormatBreak( aItemSet, aPropInfo ) ) { - aBreakItem = aItemSet.Get( RES_BREAK ); + aBreakItem.reset(static_cast<SvxFormatBreakItem*>(aItemSet.Get(RES_BREAK).Clone())); bBreakItem = true; } if( !aPropInfo.m_aId.isEmpty() ) @@ -5169,9 +5169,9 @@ void SwHTMLParser::InsertLineBreak() } } - if( bBreakItem && SvxBreak::PageAfter==aBreakItem.GetBreak() ) + if( bBreakItem && SvxBreak::PageAfter == aBreakItem->GetBreak() ) { - NewAttr(m_xAttrTab, &m_xAttrTab->pBreak, aBreakItem); + NewAttr(m_xAttrTab, &m_xAttrTab->pBreak, *aBreakItem); EndAttr( m_xAttrTab->pBreak, false ); } @@ -5190,9 +5190,9 @@ void SwHTMLParser::InsertLineBreak() // (>Netscape). That's why we don't do it. AppendTextNode( AM_NOSPACE ); } - if( bBreakItem && SvxBreak::PageBefore==aBreakItem.GetBreak() ) + if( bBreakItem && SvxBreak::PageBefore == aBreakItem->GetBreak() ) { - NewAttr(m_xAttrTab, &m_xAttrTab->pBreak, aBreakItem); + NewAttr(m_xAttrTab, &m_xAttrTab->pBreak, *aBreakItem); EndAttr( m_xAttrTab->pBreak, false ); } } diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index 3f72b20f696b..21acd5f6a2e4 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -1069,9 +1069,8 @@ const SwPageDesc *SwHTMLWriter::MakeHeader( sal_uInt16 &rHeaderAttrs ) const SfxItemSet& rItemSet = pPageDesc->GetMaster().GetAttrSet(); // fdo#86857 page styles now contain the XATTR_*, not RES_BACKGROUND - SvxBrushItem const aBrushItem( - getSvxBrushItemFromSourceSet(rItemSet, RES_BACKGROUND)); - OutBackground(&aBrushItem, true); + std::shared_ptr<SvxBrushItem> const aBrushItem(getSvxBrushItemFromSourceSet(rItemSet, RES_BACKGROUND)); + OutBackground(aBrushItem.get(), true); m_nDirection = GetHTMLDirection( rItemSet ); OutDirection( m_nDirection ); diff --git a/sw/source/filter/writer/wrt_fn.cxx b/sw/source/filter/writer/wrt_fn.cxx index b0cbff4212f3..1debd24bd0c1 100644 --- a/sw/source/filter/writer/wrt_fn.cxx +++ b/sw/source/filter/writer/wrt_fn.cxx @@ -113,11 +113,11 @@ Writer& Out_SfxItemSet( const SwAttrFnTab pTab, Writer& rWrt, // existing mechanisms. // This is the right place in the future if the adapted fill attributes // may be handled more directly in HTML export to handle them. - const SvxBrushItem aSvxBrushItem = getSvxBrushItemFromSourceSet(*pSet, RES_BACKGROUND, bDeep); + const std::shared_ptr<SvxBrushItem> aSvxBrushItem(getSvxBrushItemFromSourceSet(*pSet, RES_BACKGROUND, bDeep)); if( nullptr != ( pOut = pTab[RES_BACKGROUND - RES_CHRATR_BEGIN] )) { - (*pOut)( rWrt, aSvxBrushItem ); + (*pOut)( rWrt, *aSvxBrushItem ); } } diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 7d4d4df1fb3d..501f632ff3f2 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -944,7 +944,7 @@ void DocxExport::WriteSettings() } // Display Background Shape - if (boost::optional<SvxBrushItem> oBrush = getBackground()) + if (std::shared_ptr<SvxBrushItem> oBrush = getBackground(); oBrush) { // Turn on the 'displayBackgroundShape' pFS->singleElementNS(XML_w, XML_displayBackgroundShape); @@ -1456,7 +1456,7 @@ void DocxExport::WriteMainText() m_aLinkedTextboxesHelper.clear(); // Write background page color - if (boost::optional<SvxBrushItem> oBrush = getBackground()) + if (std::shared_ptr<SvxBrushItem> oBrush = getBackground(); oBrush) { Color backgroundColor = oBrush->GetColor(); OString aBackgroundColorStr = msfilter::util::ConvertColor(backgroundColor); diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index b2b06a77443b..2dbd38230402 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -419,7 +419,7 @@ void RtfExport::WriteMainText() { SAL_INFO("sw.rtf", OSL_THIS_FUNC << " start"); - if (boost::optional<SvxBrushItem> oBrush = getBackground()) + if (std::shared_ptr<SvxBrushItem> oBrush = getBackground(); oBrush) { Strm().WriteCharPtr(LO_STRING_SVTOOLS_RTF_VIEWBKSP).WriteChar('1'); Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_BACKGROUND); diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index f713a9c2de88..feacf1de6f9b 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -1608,11 +1608,11 @@ void SwBasicEscherEx::WriteGrfBullet(const Graphic& rGrf) aPropOpt.AddOpt( ESCHER_Prop_dxTextLeft, 0 ); aPropOpt.AddOpt( ESCHER_Prop_dxTextRight, 0 ); const Color aTmpColor( COL_WHITE ); - SvxBrushItem aBrush( aTmpColor, RES_BACKGROUND ); - const SvxBrushItem *pRet = rWrt.GetCurrentPageBgBrush(); + std::shared_ptr<SvxBrushItem> aBrush(std::make_shared<SvxBrushItem>(aTmpColor, RES_BACKGROUND)); + const SvxBrushItem* pRet = rWrt.GetCurrentPageBgBrush(); if (pRet && (pRet->GetGraphic() ||( pRet->GetColor() != COL_TRANSPARENT))) - aBrush = *pRet; - WriteBrushAttr(aBrush, aPropOpt); + aBrush.reset(static_cast<SvxBrushItem*>(pRet->Clone())); + WriteBrushAttr(*aBrush, aPropOpt); aPropOpt.AddOpt( ESCHER_Prop_pictureActive, 0 ); aPropOpt.Commit( GetStream() ); @@ -2080,13 +2080,21 @@ sal_Int32 SwBasicEscherEx::WriteFlyFrameAttr(const SwFrameFormat& rFormat, if (bIsInHeader) { - SvxBrushItem aBrush(rFormat.makeBackgroundBrushItem()); - WriteBrushAttr(aBrush, rPropOpt); + std::shared_ptr<SvxBrushItem> aBrush(rFormat.makeBackgroundBrushItem()); + + if(aBrush) + { + WriteBrushAttr(*aBrush, rPropOpt); + } } else { - SvxBrushItem aBrush(rWrt.TrueFrameBgBrush(rFormat)); - WriteBrushAttr(aBrush, rPropOpt); + std::shared_ptr<SvxBrushItem> aBrush(rWrt.TrueFrameBgBrush(rFormat)); + + if(aBrush) + { + WriteBrushAttr(*aBrush, rPropOpt); + } } const SdrObject* pObj = rFormat.FindRealSdrObject(); diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index e89563655fd7..d08796457530 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -1623,7 +1623,7 @@ const SvxBrushItem* WW8Export::GetCurrentPageBgBrush() const return pRet; } -SvxBrushItem WW8Export::TrueFrameBgBrush(const SwFrameFormat &rFlyFormat) const +std::shared_ptr<SvxBrushItem> WW8Export::TrueFrameBgBrush(const SwFrameFormat &rFlyFormat) const { const SwFrameFormat *pFlyFormat = &rFlyFormat; const SvxBrushItem* pRet = nullptr; @@ -1657,9 +1657,12 @@ SvxBrushItem WW8Export::TrueFrameBgBrush(const SwFrameFormat &rFlyFormat) const pRet = GetCurrentPageBgBrush(); const Color aTmpColor( COL_WHITE ); - SvxBrushItem aRet( aTmpColor, RES_BACKGROUND ); + std::shared_ptr<SvxBrushItem> aRet(std::make_shared<SvxBrushItem>(aTmpColor, RES_BACKGROUND)); + if (pRet && (pRet->GetGraphic() ||( pRet->GetColor() != COL_TRANSPARENT))) - aRet = *pRet; + { + aRet.reset(static_cast<SvxBrushItem*>(pRet->Clone())); + } return aRet; } diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 07ba40b373fd..1ccca8f8eb78 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -1522,17 +1522,17 @@ void WW8Export::AppendBookmarkEndWithCorrection( const OUString& rName ) m_pBkmks->Append( nEndCP - 1, rName ); } -boost::optional<SvxBrushItem> MSWordExportBase::getBackground() +std::shared_ptr<SvxBrushItem> MSWordExportBase::getBackground() { - boost::optional<SvxBrushItem> oRet; + std::shared_ptr<SvxBrushItem> oRet; const SwFrameFormat &rFormat = m_pDoc->GetPageDesc(0).GetMaster(); - SvxBrushItem aBrush(RES_BACKGROUND); + std::shared_ptr<SvxBrushItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND)); SfxItemState eState = rFormat.GetBackgroundState(aBrush); if (SfxItemState::SET == eState) { // The 'color' is set for the first page style - take it and use it as the background color of the entire DOCX - if (aBrush.GetColor() != COL_AUTO) + if (aBrush->GetColor() != COL_AUTO) oRet = aBrush; } return oRet; diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index c40b36a81bf8..1be70995ca50 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -878,7 +878,7 @@ protected: void SetCurPam(sal_uLong nStt, sal_uLong nEnd); /// Get background color of the document, if there is one. - boost::optional<SvxBrushItem> getBackground(); + std::shared_ptr<SvxBrushItem> getBackground(); /// Populates m_vecBulletPic with all the bullet graphics used by numberings. int CollectGrfsOfBullets(); /// Write the numbering picture bullets. @@ -1033,7 +1033,7 @@ public: void WriteFootnoteBegin( const SwFormatFootnote& rFootnote, ww::bytes* pO = nullptr ); void WritePostItBegin( ww::bytes* pO = nullptr ); const SvxBrushItem* GetCurrentPageBgBrush() const; - SvxBrushItem TrueFrameBgBrush(const SwFrameFormat &rFlyFormat) const; + std::shared_ptr<SvxBrushItem> TrueFrameBgBrush(const SwFrameFormat &rFlyFormat) const; void AppendFlyInFlys(const ww8::Frame& rFrameFormat, const Point& rNdTopLeft); void WriteOutliner(const OutlinerParaObject& rOutliner, sal_uInt8 nTyp); diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 886ea9dbc904..710e3bf6e86e 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -310,7 +310,8 @@ void MSWordExportBase::OutputItemSet( const SfxItemSet& rSet, bool bPapFormat, b if (pXFillStyleItem && pXFillStyleItem->GetValue() == drawing::FillStyle_SOLID && !rSet.HasItem(RES_BACKGROUND)) { // Construct an SvxBrushItem, as expected by the exporters. - AttrOutput().OutputItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND)); + std::shared_ptr<SvxBrushItem> aBrush(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND)); + AttrOutput().OutputItem(*aBrush); } } m_pISet = nullptr; // for double attributes @@ -853,7 +854,8 @@ void MSWordExportBase::OutputFormat( const SwFormat& rFormat, bool bPapFormat, b case drawing::FillStyle_SOLID: { // Construct an SvxBrushItem, as expected by the exporters. - aSet.Put(getSvxBrushItemFromSourceSet(rFrameFormat.GetAttrSet(), RES_BACKGROUND)); + std::shared_ptr<SvxBrushItem> aBrush(getSvxBrushItemFromSourceSet(rFrameFormat.GetAttrSet(), RES_BACKGROUND)); + aSet.Put(*aBrush); break; } default: diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 060fcd09c6cb..bef9cc9cd8a3 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1487,7 +1487,7 @@ const SfxPoolItem* SwWW8FltControlStack::GetFormatAttr(const SwPosition& rPos, if (const SfxItemSet *pSet = pNd->GetpSwAttrSet()) eState = pSet->GetItemState(RES_LR_SPACE, false); if (eState != SfxItemState::SET && rReader.m_nCurrentColl < rReader.m_vColl.size()) - pItem = &(rReader.m_vColl[rReader.m_nCurrentColl].maWordLR); + pItem = rReader.m_vColl[rReader.m_nCurrentColl].maWordLR.get(); } /* @@ -1660,7 +1660,7 @@ void SwWW8ImplReader::Read_Tab(sal_uInt16 , const sal_uInt8* pData, short nLen) WW8_TBD const * pTyp = reinterpret_cast<WW8_TBD const *>(pData + 2*nDel + 2*nIns + 2); // Type Array - SvxTabStopItem aAttr(0, 0, SvxTabAdjust::Default, RES_PARATR_TABSTOP); + std::shared_ptr<SvxTabStopItem> aAttr(std::make_shared<SvxTabStopItem>(0, 0, SvxTabAdjust::Default, RES_PARATR_TABSTOP)); const SwFormat * pSty = nullptr; sal_uInt16 nTabBase; @@ -1686,7 +1686,9 @@ void SwWW8ImplReader::Read_Tab(sal_uInt16 , const sal_uInt8* pData, short nLen) bFound = pSty->GetAttrSet().GetItemState(RES_PARATR_TABSTOP, false, &pTabs) == SfxItemState::SET; if( bFound ) - aAttr = *static_cast<const SvxTabStopItem*>(pTabs); + { + aAttr.reset(static_cast<SvxTabStopItem*>(pTabs->Clone())); + } else { sal_uInt16 nOldTabBase = nTabBase; @@ -1719,9 +1721,9 @@ void SwWW8ImplReader::Read_Tab(sal_uInt16 , const sal_uInt8* pData, short nLen) SvxTabStop aTabStop; for (short i=0; i < nDel; ++i) { - sal_uInt16 nPos = aAttr.GetPos(SVBT16ToUInt16(pDel + i*2)); + sal_uInt16 nPos = aAttr->GetPos(SVBT16ToUInt16(pDel + i*2)); if( nPos != SVX_TAB_NOTFOUND ) - aAttr.Remove( nPos ); + aAttr->Remove( nPos ); } for (short i=0; i < nIns; ++i) @@ -1763,14 +1765,14 @@ void SwWW8ImplReader::Read_Tab(sal_uInt16 , const sal_uInt8* pData, short nLen) break; } - sal_uInt16 nPos2 = aAttr.GetPos( nPos ); + sal_uInt16 nPos2 = aAttr->GetPos( nPos ); if (nPos2 != SVX_TAB_NOTFOUND) - aAttr.Remove(nPos2); // Or else Insert() refuses - aAttr.Insert(aTabStop); + aAttr->Remove(nPos2); // Or else Insert() refuses + aAttr->Insert(aTabStop); } if (nIns || nDel) - NewAttr(aAttr); + NewAttr(*aAttr); else { // Here we have a tab definition which inserts no extra tabs, or deletes diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 33b0a9349141..f7be682a8d1c 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -239,7 +239,7 @@ public: sal_uInt16 m_n81Flags; // for bold, italic, ... sal_uInt16 m_n81BiDiFlags; // for bold, italic, ... - SvxLRSpaceItem maWordLR; + std::shared_ptr<SvxLRSpaceItem> maWordLR; bool m_bValid; // empty of valid bool m_bImported; // for recursive imports bool m_bColl; // true-> pFormat is SwTextFormatColl @@ -271,7 +271,7 @@ public: mnWW8OutlineLevel( MAXLEVEL ), m_n81Flags( 0 ), m_n81BiDiFlags(0), - maWordLR( RES_LR_SPACE ), + maWordLR(std::make_shared<SvxLRSpaceItem>(RES_LR_SPACE)), m_bValid(false), m_bImported(false), m_bColl(false), diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 829011373542..f28a076da3b1 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -1757,8 +1757,7 @@ void SwWW8ImplReader::RegisterNumFormatOnStyle(sal_uInt16 nStyle) if (rStyleInf.m_bValid && rStyleInf.m_pFormat) { //Save old pre-list modified indent, which are the word indent values - rStyleInf.maWordLR = - ItemGet<SvxLRSpaceItem>(*rStyleInf.m_pFormat, RES_LR_SPACE); + rStyleInf.maWordLR.reset(static_cast<SvxLRSpaceItem*>(ItemGet<SvxLRSpaceItem>(*rStyleInf.m_pFormat, RES_LR_SPACE).Clone())); // Phase 2: refresh StyleDef after reading all Lists SwNumRule* pNmRule = nullptr; @@ -1991,19 +1990,19 @@ void SwWW8ImplReader::Read_LFOPosition(sal_uInt16, const sal_uInt8* pData, pTextNode->SetAttr( aEmptyRule ); // create an empty SvxLRSpaceItem - SvxLRSpaceItem aLR( RES_LR_SPACE ); + std::shared_ptr<SvxLRSpaceItem> aLR(std::make_shared<SvxLRSpaceItem>(RES_LR_SPACE)); // replace it with the one of the current node if it exist const SfxPoolItem* pLR = GetFormatAttr(RES_LR_SPACE); if( pLR ) - aLR = *static_cast<const SvxLRSpaceItem*>(pLR); + aLR.reset(static_cast<SvxLRSpaceItem*>(pLR->Clone())); // reset/blank the left indent (and only the left) - aLR.SetTextLeft(0); - aLR.SetTextFirstLineOfst(0); + aLR->SetTextLeft(0); + aLR->SetTextFirstLineOfst(0); // apply the modified SvxLRSpaceItem to the current paragraph - pTextNode->SetAttr( aLR ); + pTextNode->SetAttr( *aLR ); } m_nLFOPosition = USHRT_MAX; diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index f95859e553a5..bcb276246418 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -4139,10 +4139,10 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe short nPara = SVBT16ToUInt16( pData ); - SvxLRSpaceItem aLR( RES_LR_SPACE ); + std::shared_ptr<SvxLRSpaceItem> aLR(std::make_shared<SvxLRSpaceItem>(RES_LR_SPACE)); const SfxPoolItem* pLR = GetFormatAttr(RES_LR_SPACE); if( pLR ) - aLR = *static_cast<const SvxLRSpaceItem*>(pLR); + aLR.reset(static_cast<SvxLRSpaceItem*>(pLR->Clone())); // Fix the regression issue: #i99822#: Discussion? // Since the list level formatting doesn't apply into paragraph style @@ -4159,10 +4159,10 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe const SwNumFormat* pFormat = pNumRule->GetNumFormat( nLvl ); if ( pFormat && pFormat->GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) { - aLR.SetTextLeft( pFormat->GetIndentAt() ); - aLR.SetTextFirstLineOfst( static_cast<short>(pFormat->GetFirstLineIndent()) ); + aLR->SetTextLeft( pFormat->GetIndentAt() ); + aLR->SetTextFirstLineOfst( static_cast<short>(pFormat->GetFirstLineIndent()) ); // make paragraph have hard-set indent attributes - pTextNode->SetAttr( aLR ); + pTextNode->SetAttr( *aLR ); } } } @@ -4202,7 +4202,7 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe case NS_sprm::v6::sprmPDxaLeft: case NS_sprm::sprmPDxaLeft80: case NS_sprm::sprmPDxaLeft: - aLR.SetTextLeft( nPara ); + aLR->SetTextLeft( nPara ); if (m_pCurrentColl && m_nCurrentColl < m_vColl.size()) { m_vColl[m_nCurrentColl].m_bListReleventIndentSet = true; @@ -4236,7 +4236,7 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe } } - aLR.SetTextFirstLineOfst(nPara); + aLR->SetTextFirstLineOfst(nPara); if (!m_pCurrentColl) { @@ -4246,7 +4246,7 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe { if (!lcl_HasExplicitLeft(m_xPlcxMan.get(), m_bVer67)) { - aLR.SetTextLeft(pNumFormat->GetIndentAt()); + aLR->SetTextLeft(pNumFormat->GetIndentAt()); // If have not explicit left, set number format list tab position is doc default tab const SvxTabStopItem *pDefaultStopItem = m_rDoc.GetAttrPool().GetPoolDefaultItem(RES_PARATR_TABSTOP); @@ -4266,13 +4266,13 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe case NS_sprm::v6::sprmPDxaRight: case NS_sprm::sprmPDxaRight80: case NS_sprm::sprmPDxaRight: - aLR.SetRight( nPara ); + aLR->SetRight( nPara ); break; default: return; } - NewAttr( aLR, bFirstLinOfstSet, bLeftIndentSet ); // #i103711#, #i105414# + NewAttr( *aLR, bFirstLinOfstSet, bLeftIndentSet ); // #i103711#, #i105414# } // Sprm 20 @@ -4982,29 +4982,29 @@ void SwWW8ImplReader::Read_Border(sal_uInt16 , const sal_uInt8*, short nLen) // otherwise it's not possible to turn of the style attribute hard. const SvxBoxItem* pBox = static_cast<const SvxBoxItem*>(GetFormatAttr( RES_BOX )); - SvxBoxItem aBox(RES_BOX); + std::shared_ptr<SvxBoxItem> aBox(std::make_shared<SvxBoxItem>(RES_BOX)); if (pBox) - aBox = *pBox; + aBox.reset(static_cast<SvxBoxItem*>(pBox->Clone())); short aSizeArray[5]={0}; - SetBorder(aBox, aBrcs, &aSizeArray[0], nBorder); + SetBorder(*aBox, aBrcs, &aSizeArray[0], nBorder); tools::Rectangle aInnerDist; GetBorderDistance( aBrcs, aInnerDist ); if (nBorder & (1 << WW8_LEFT)) - aBox.SetDistance( static_cast<sal_uInt16>(aInnerDist.Left()), SvxBoxItemLine::LEFT ); + aBox->SetDistance( static_cast<sal_uInt16>(aInnerDist.Left()), SvxBoxItemLine::LEFT ); if (nBorder & (1 << WW8_TOP)) - aBox.SetDistance( static_cast<sal_uInt16>(aInnerDist.Top()), SvxBoxItemLine::TOP ); + aBox->SetDistance( static_cast<sal_uInt16>(aInnerDist.Top()), SvxBoxItemLine::TOP ); if (nBorder & (1 << WW8_RIGHT)) - aBox.SetDistance( static_cast<sal_uInt16>(aInnerDist.Right()), SvxBoxItemLine::RIGHT ); + aBox->SetDistance( static_cast<sal_uInt16>(aInnerDist.Right()), SvxBoxItemLine::RIGHT ); if (nBorder & (1 << WW8_BOT)) - aBox.SetDistance( static_cast<sal_uInt16>(aInnerDist.Bottom()), SvxBoxItemLine::BOTTOM ); + aBox->SetDistance( static_cast<sal_uInt16>(aInnerDist.Bottom()), SvxBoxItemLine::BOTTOM ); - NewAttr( aBox ); + NewAttr( *aBox ); SvxShadowItem aS(RES_SHADOW); if( SetShadow( aS, &aSizeArray[0], aBrcs[WW8_RIGHT] ) ) @@ -5031,8 +5031,7 @@ void SwWW8ImplReader::Read_CharBorder(sal_uInt16 nId, const sal_uInt8* pData, sh = static_cast<const SvxBoxItem*>(GetFormatAttr( RES_CHRATR_BOX )); if( pBox ) { - SvxBoxItem aBoxItem(RES_CHRATR_BOX); - aBoxItem = *pBox; + std::shared_ptr<SvxBoxItem> aBoxItem(static_cast<SvxBoxItem*>(pBox->Clone())); WW8_BRCVer9 aBrc; int nBrcVer = (nId == NS_sprm::sprmCBrc) ? 9 : (m_bVer67 ? 6 : 8); @@ -5041,11 +5040,11 @@ void SwWW8ImplReader::Read_CharBorder(sal_uInt16 nId, const sal_uInt8* pData, sh // Border style is none -> no border, no shadow if( editeng::ConvertBorderStyleFromWord(aBrc.brcType()) != SvxBorderLineStyle::NONE ) { - Set1Border(aBoxItem, aBrc, SvxBoxItemLine::TOP, 0, nullptr, true); - Set1Border(aBoxItem, aBrc, SvxBoxItemLine::BOTTOM, 0, nullptr, true); - Set1Border(aBoxItem, aBrc, SvxBoxItemLine::LEFT, 0, nullptr, true); - Set1Border(aBoxItem, aBrc, SvxBoxItemLine::RIGHT, 0, nullptr, true); - NewAttr( aBoxItem ); + Set1Border(*aBoxItem, aBrc, SvxBoxItemLine::TOP, 0, nullptr, true); + Set1Border(*aBoxItem, aBrc, SvxBoxItemLine::BOTTOM, 0, nullptr, true); + Set1Border(*aBoxItem, aBrc, SvxBoxItemLine::LEFT, 0, nullptr, true); + Set1Border(*aBoxItem, aBrc, SvxBoxItemLine::RIGHT, 0, nullptr, true); + NewAttr( *aBoxItem ); short aSizeArray[WW8_RIGHT+1]={0}; aSizeArray[WW8_RIGHT] = 1; SvxShadowItem aShadowItem(RES_CHRATR_SHADOW); diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index 8d5fcc9013c4..1dff89e08cb1 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -146,12 +146,12 @@ class SectRepr private: SwSectionData m_SectionData; SwFormatCol m_Col; - SvxBrushItem m_Brush; + std::shared_ptr<SvxBrushItem> m_Brush; SwFormatFootnoteAtTextEnd m_FootnoteNtAtEnd; SwFormatEndAtTextEnd m_EndNtAtEnd; SwFormatNoBalancedColumns m_Balance; - SvxFrameDirectionItem m_FrameDirItem; - SvxLRSpaceItem m_LRSpaceItem; + std::shared_ptr<SvxFrameDirectionItem> m_FrameDirItem; + std::shared_ptr<SvxLRSpaceItem> m_LRSpaceItem; const size_t m_nArrPos; // shows, if maybe textcontent is in the region bool m_bContent : 1; @@ -164,12 +164,12 @@ public: SwSectionData & GetSectionData() { return m_SectionData; } SwFormatCol& GetCol() { return m_Col; } - SvxBrushItem& GetBackground() { return m_Brush; } + std::shared_ptr<SvxBrushItem>& GetBackground() { return m_Brush; } SwFormatFootnoteAtTextEnd& GetFootnoteNtAtEnd() { return m_FootnoteNtAtEnd; } SwFormatEndAtTextEnd& GetEndNtAtEnd() { return m_EndNtAtEnd; } SwFormatNoBalancedColumns& GetBalance() { return m_Balance; } - SvxFrameDirectionItem& GetFrameDir() { return m_FrameDirItem; } - SvxLRSpaceItem& GetLRSpace() { return m_LRSpaceItem; } + std::shared_ptr<SvxFrameDirectionItem>& GetFrameDir() { return m_FrameDirItem; } + std::shared_ptr<SvxLRSpaceItem>& GetLRSpace() { return m_LRSpaceItem; } size_t GetArrPos() const { return m_nArrPos; } OUString GetFile() const; @@ -191,9 +191,9 @@ public: SectRepr::SectRepr( size_t nPos, SwSection& rSect ) : m_SectionData( rSect ) - , m_Brush( RES_BACKGROUND ) - , m_FrameDirItem( SvxFrameDirection::Environment, RES_FRAMEDIR ) - , m_LRSpaceItem( RES_LR_SPACE ) + , m_Brush(std::make_shared<SvxBrushItem>(RES_BACKGROUND)) + , m_FrameDirItem(std::make_shared<SvxFrameDirectionItem>(SvxFrameDirection::Environment, RES_FRAMEDIR)) + , m_LRSpaceItem(std::make_shared<SvxLRSpaceItem>(RES_LR_SPACE)) , m_nArrPos(nPos) , m_bContent(m_SectionData.GetLinkFileName().isEmpty()) , m_bSelected(false) @@ -206,8 +206,8 @@ SectRepr::SectRepr( size_t nPos, SwSection& rSect ) m_FootnoteNtAtEnd = pFormat->GetFootnoteAtTextEnd(); m_EndNtAtEnd = pFormat->GetEndAtTextEnd(); m_Balance.SetValue(pFormat->GetBalancedColumns().GetValue()); - m_FrameDirItem = pFormat->GetFrameDir(); - m_LRSpaceItem = pFormat->GetLRSpace(); + m_FrameDirItem.reset(static_cast<SvxFrameDirectionItem*>(pFormat->GetFrameDir().Clone())); + m_LRSpaceItem.reset(static_cast<SvxLRSpaceItem*>(pFormat->GetLRSpace().Clone())); } } @@ -779,9 +779,9 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OkHdl, weld::Button&, void) if( pFormat->GetCol() != pRepr->GetCol() ) pSet->Put( pRepr->GetCol() ); - SvxBrushItem aBrush(pFormat->makeBackgroundBrushItem(false)); - if( aBrush != pRepr->GetBackground() ) - pSet->Put( pRepr->GetBackground() ); + std::shared_ptr<SvxBrushItem> aBrush(pFormat->makeBackgroundBrushItem(false)); + if( aBrush != pRepr->GetBackground() || (aBrush && pRepr->GetBackground() && *aBrush != *pRepr->GetBackground())) + pSet->Put( *pRepr->GetBackground() ); if( pFormat->GetFootnoteAtTextEnd(false) != pRepr->GetFootnoteNtAtEnd() ) pSet->Put( pRepr->GetFootnoteNtAtEnd() ); @@ -792,11 +792,11 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OkHdl, weld::Button&, void) if( pFormat->GetBalancedColumns() != pRepr->GetBalance() ) pSet->Put( pRepr->GetBalance() ); - if( pFormat->GetFrameDir() != pRepr->GetFrameDir() ) - pSet->Put( pRepr->GetFrameDir() ); + if( pFormat->GetFrameDir() != *pRepr->GetFrameDir() ) + pSet->Put( *pRepr->GetFrameDir() ); - if( pFormat->GetLRSpace() != pRepr->GetLRSpace()) - pSet->Put( pRepr->GetLRSpace()); + if( pFormat->GetLRSpace() != *pRepr->GetLRSpace()) + pSet->Put( *pRepr->GetLRSpace()); rSh.UpdateSection( nNewPos, pRepr->GetSectionData(), pSet->Count() ? pSet.get() : nullptr ); @@ -1029,12 +1029,12 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OptionsHdl, weld::Button&, void) SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE>{}); aSet.Put( pSectRepr->GetCol() ); - aSet.Put( pSectRepr->GetBackground() ); + aSet.Put( *pSectRepr->GetBackground() ); aSet.Put( pSectRepr->GetFootnoteNtAtEnd() ); aSet.Put( pSectRepr->GetEndNtAtEnd() ); aSet.Put( pSectRepr->GetBalance() ); - aSet.Put( pSectRepr->GetFrameDir() ); - aSet.Put( pSectRepr->GetLRSpace() ); + aSet.Put( *pSectRepr->GetFrameDir() ); + aSet.Put( *pSectRepr->GetLRSpace() ); const SwSectionFormats& rDocFormats = rSh.GetDoc()->GetSections(); SwSectionFormats aOrigArray(rDocFormats); @@ -1085,7 +1085,7 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OptionsHdl, weld::Button&, void) if( SfxItemState::SET == eColState ) pRepr->GetCol() = *static_cast<const SwFormatCol*>(pColItem); if( SfxItemState::SET == eBrushState ) - pRepr->GetBackground() = *static_cast<const SvxBrushItem*>(pBrushItem); + pRepr->GetBackground().reset(static_cast<SvxBrushItem*>(pBrushItem->Clone())); if( SfxItemState::SET == eFootnoteState ) pRepr->GetFootnoteNtAtEnd() = *static_cast<const SwFormatFootnoteAtTextEnd*>(pFootnoteItem); if( SfxItemState::SET == eEndState ) @@ -1093,9 +1093,9 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OptionsHdl, weld::Button&, void) if( SfxItemState::SET == eBalanceState ) pRepr->GetBalance().SetValue(static_cast<const SwFormatNoBalancedColumns*>(pBalanceItem)->GetValue()); if( SfxItemState::SET == eFrameDirState ) - pRepr->GetFrameDir().SetValue(static_cast<const SvxFrameDirectionItem*>(pFrameDirItem)->GetValue()); + pRepr->GetFrameDir()->SetValue(static_cast<const SvxFrameDirectionItem*>(pFrameDirItem)->GetValue()); if( SfxItemState::SET == eLRState ) - pRepr->GetLRSpace() = *static_cast<const SvxLRSpaceItem*>(pLRSpaceItem); + pRepr->GetLRSpace().reset(static_cast<SvxLRSpaceItem*>(pLRSpaceItem->Clone())); return false; }); } diff --git a/sw/source/ui/frmdlg/wrap.cxx b/sw/source/ui/frmdlg/wrap.cxx index 1ca392a35e07..c02e9426671b 100644 --- a/sw/source/ui/frmdlg/wrap.cxx +++ b/sw/source/ui/frmdlg/wrap.cxx @@ -258,13 +258,12 @@ bool SwWrapTabPage::FillItemSet(SfxItemSet *rSet) const SwFormatSurround& rOldSur = GetItemSet().Get(RES_SURROUND); SwFormatSurround aSur( rOldSur ); - SvxOpaqueItem aOp( RES_OPAQUE); + std::shared_ptr<SvxOpaqueItem> aOp(std::make_shared<SvxOpaqueItem>(RES_OPAQUE)); if (!m_bDrawMode) { - const SvxOpaqueItem& rOpaque = GetItemSet().Get(RES_OPAQUE); - aOp = rOpaque; - aOp.SetValue(true); + aOp.reset(static_cast<SvxOpaqueItem*>(GetItemSet().Get(RES_OPAQUE).Clone())); + aOp->SetValue(true); } if (m_xNoWrapRB->get_active()) @@ -279,7 +278,7 @@ bool SwWrapTabPage::FillItemSet(SfxItemSet *rSet) { aSur.SetSurround(css::text::WrapTextMode_THROUGH); if (m_xWrapTransparentCB->get_active() && !m_bDrawMode) - aOp.SetValue(false); + aOp->SetValue(false); } else if (m_xIdealWrapRB->get_active()) aSur.SetSurround(css::text::WrapTextMode_DYNAMIC); @@ -301,9 +300,9 @@ bool SwWrapTabPage::FillItemSet(SfxItemSet *rSet) if (!m_bDrawMode) { if(nullptr == (pOldItem = GetOldItem( *rSet, FN_OPAQUE )) || - aOp != *pOldItem ) + *aOp != *pOldItem ) { - rSet->Put(aOp); + rSet->Put(*aOp); bModified = true; } } diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx index 9e52c5b00b29..2830fa1a726c 100644 --- a/sw/source/uibase/app/apphdl.cxx +++ b/sw/source/uibase/app/apphdl.cxx @@ -309,7 +309,7 @@ SwView* lcl_LoadDoc(SwView* pView, const OUString& rURL) if(!rURL.isEmpty()) { SfxStringItem aURL(SID_FILE_NAME, rURL); - SfxStringItem aTargetFrameName( SID_TARGETNAME, OUString("_blank") ); + SfxStringItem aTargetFrameName( SID_TARGETNAME, "_blank" ); SfxBoolItem aHidden( SID_HIDDEN, true ); SfxStringItem aReferer(SID_REFERER, pView->GetDocShell()->GetTitle()); const SfxObjectItem* pItem = static_cast<const SfxObjectItem*>( diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 0819b4022553..2139a02a5240 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -1210,8 +1210,8 @@ void SwDocShell::Execute(SfxRequest& rReq) // Ok. I did my best. break; - SfxStringItem aApp(SID_DOC_SERVICE, OUString("com.sun.star.text.TextDocument")); - SfxStringItem aTarget(SID_TARGETNAME, OUString("_blank")); + SfxStringItem aApp(SID_DOC_SERVICE, "com.sun.star.text.TextDocument"); + SfxStringItem aTarget(SID_TARGETNAME, "_blank"); pViewShell->GetDispatcher()->ExecuteList(SID_OPENDOC, SfxCallMode::API|SfxCallMode::SYNCHRON, { &aApp, &aTarget }); diff --git a/sw/source/uibase/docvw/romenu.cxx b/sw/source/uibase/docvw/romenu.cxx index 1b8c671ba411..185ff672d42f 100644 --- a/sw/source/uibase/docvw/romenu.cxx +++ b/sw/source/uibase/docvw/romenu.cxx @@ -106,7 +106,7 @@ SwReadOnlyPopup::SwReadOnlyPopup(const Point &rDPos, SwView &rV) , m_nReadonlyFullscreen(m_xMenu->GetItemId("fullscreen")) , m_nReadonlyCopy(m_xMenu->GetItemId("copy")) , m_rView(rV) - , m_aBrushItem(RES_BACKGROUND) + , m_aBrushItem(std::make_shared<SvxBrushItem>(RES_BACKGROUND)) { m_bGrfToGalleryAsLnk = SW_MOD()->GetModuleConfig()->IsGrfToGalleryAsLnk(); SwWrtShell &rSh = m_rView.GetWrtShell(); @@ -159,10 +159,10 @@ SwReadOnlyPopup::SwReadOnlyPopup(const Point &rDPos, SwView &rV) bool bEnableBackGallery = false, bEnableBack = false; - if ( GPOS_NONE != m_aBrushItem.GetGraphicPos() ) + if ( m_aBrushItem && GPOS_NONE != m_aBrushItem->GetGraphicPos() ) { bEnableBack = true; - if ( !m_aBrushItem.GetGraphicLink().isEmpty() ) + if ( !m_aBrushItem->GetGraphicLink().isEmpty() ) { if ( m_aThemeList.empty() ) GalleryExplorer::FillThemeList( m_aThemeList ); @@ -240,11 +240,11 @@ void SwReadOnlyPopup::Execute( vcl::Window* pWin, sal_uInt16 nId ) { OUString sTmp; sal_uInt16 nSaveId; - if (nId >= MN_READONLY_BACKGROUNDTOGALLERY) + if (m_aBrushItem && nId >= MN_READONLY_BACKGROUNDTOGALLERY) { nId -= MN_READONLY_BACKGROUNDTOGALLERY; nSaveId = m_nReadonlySaveBackground; - sTmp = m_aBrushItem.GetGraphicLink(); + sTmp = m_aBrushItem->GetGraphicLink(); } else { @@ -331,14 +331,14 @@ OUString SwReadOnlyPopup::SaveGraphic(sal_uInt16 nId) // fish out the graphic's name if (nId == m_nReadonlySaveBackground) { - if ( !m_aBrushItem.GetGraphicLink().isEmpty() ) - m_sGrfName = m_aBrushItem.GetGraphicLink(); - const Graphic *pGrf = m_aBrushItem.GetGraphic(); + if ( m_aBrushItem && !m_aBrushItem->GetGraphicLink().isEmpty() ) + m_sGrfName = m_aBrushItem->GetGraphicLink(); + const Graphic *pGrf = m_aBrushItem ? m_aBrushItem->GetGraphic() : nullptr; if ( pGrf ) { m_aGraphic = *pGrf; - if ( !m_aBrushItem.GetGraphicLink().isEmpty() ) - m_sGrfName = m_aBrushItem.GetGraphicLink(); + if ( !m_aBrushItem->GetGraphicLink().isEmpty() ) + m_sGrfName = m_aBrushItem->GetGraphicLink(); } else return OUString(); diff --git a/sw/source/uibase/docvw/romenu.hxx b/sw/source/uibase/docvw/romenu.hxx index 18a9bccd0f35..54df7fb8bb57 100644 --- a/sw/source/uibase/docvw/romenu.hxx +++ b/sw/source/uibase/docvw/romenu.hxx @@ -58,7 +58,7 @@ class SwReadOnlyPopup sal_uInt16 const m_nReadonlyCopy; SwView &m_rView; - SvxBrushItem m_aBrushItem; + std::shared_ptr<SvxBrushItem> m_aBrushItem; Graphic m_aGraphic; OUString m_sURL, m_sTargetFrameName; diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index 79990b849654..b1d0054dec3d 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -1724,19 +1724,24 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) SfxItemSet aSet(pOLV->GetAttribs()); SvtScriptType nScript = pOLV->GetSelectedScriptType(); - SvxFontItem aSetDlgFont( RES_CHRATR_FONT ); + std::shared_ptr<SvxFontItem> aSetDlgFont(std::make_shared<SvxFontItem>(RES_CHRATR_FONT)); { SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() ); aSetItem.GetItemSet().Put( aSet, false ); const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript ); if( pI ) - aSetDlgFont = *static_cast<const SvxFontItem*>(pI); + { + aSetDlgFont.reset(static_cast<SvxFontItem*>(pI->Clone())); + } else - aSetDlgFont = static_cast<const SvxFontItem&>(aSet.Get( GetWhichOfScript( + { + aSetDlgFont.reset(static_cast<SvxFontItem*>(aSet.Get( GetWhichOfScript( SID_ATTR_CHAR_FONT, - SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ) ))); + SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ) )).Clone())); + } + if (sFontName.isEmpty()) - sFontName = aSetDlgFont.GetFamilyName(); + sFontName = aSetDlgFont->GetFamilyName(); } vcl::Font aFont(sFontName, Size(1,1)); @@ -1752,7 +1757,7 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) if( !sSymbolFont.isEmpty() ) aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) ); else - aAllSet.Put( SfxStringItem( SID_FONT_NAME, aSetDlgFont.GetFamilyName() ) ); + aAllSet.Put( SfxStringItem( SID_FONT_NAME, aSetDlgFont->GetFamilyName() ) ); // If character is selected then it can be shown. ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(rView.GetFrameWeld(), aAllSet, true)); diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index fa22a93d72ff..0a3a735fdd02 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -2202,7 +2202,7 @@ void SwBaseShell::GetBckColState(SfxItemSet &rSet) SfxWhichIter aIter(rSet); sal_uInt16 nWhich(aIter.FirstWhich()); SelectionType nSelType(rSh.GetSelectionType()); - SvxBrushItem aBrushItem(RES_BACKGROUND); + std::shared_ptr<SvxBrushItem> aBrushItem(std::make_shared<SvxBrushItem>(RES_BACKGROUND)); if( nWhich == SID_TABLE_CELL_BACKGROUND_COLOR ) { @@ -2234,15 +2234,18 @@ void SwBaseShell::GetBckColState(SfxItemSet &rSet) case SID_BACKGROUND_COLOR: case SID_TABLE_CELL_BACKGROUND_COLOR: { - SvxColorItem aColorItem(aBrushItem.GetColor(),SID_BACKGROUND_COLOR); + SvxColorItem aColorItem(aBrushItem->GetColor(),SID_BACKGROUND_COLOR); rSet.Put(aColorItem); break; } case SID_ATTR_BRUSH: case RES_BACKGROUND: { - std::unique_ptr<SfxPoolItem> pNewItem(aBrushItem.CloneSetWhich(GetPool().GetWhich(nWhich))); - rSet.Put(*pNewItem); + // if this was intended to have a independent copy of the Item to be set + // this is not needed due to the ItemSet/Pool cloning Items which get set anyways. + // Keeping code as reference - it may have had other reasons I do notz see (?!?) + // std::unique_ptr<SfxPoolItem> pNewItem(aBrushItem.CloneSetWhich(GetPool().GetWhich(nWhich))); + rSet.Put(*aBrushItem); break; } } @@ -2263,7 +2266,7 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq) return; } - SvxBrushItem aBrushItem(RES_BACKGROUND); + std::shared_ptr<SvxBrushItem> aBrushItem(std::make_shared<SvxBrushItem>(RES_BACKGROUND)); if ( nSlot == SID_TABLE_CELL_BACKGROUND_COLOR ) { @@ -2293,18 +2296,18 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq) case SID_BACKGROUND_COLOR: case SID_TABLE_CELL_BACKGROUND_COLOR: { - aBrushItem.SetGraphicPos(GPOS_NONE); + aBrushItem->SetGraphicPos(GPOS_NONE); if(pArgs) { const SvxColorItem& rNewColorItem = pArgs->Get(nSlot == SID_BACKGROUND_COLOR ? SID_BACKGROUND_COLOR : SID_TABLE_CELL_BACKGROUND_COLOR ); const Color& rNewColor = rNewColorItem.GetValue(); - aBrushItem.SetColor(rNewColor); + aBrushItem->SetColor(rNewColor); GetView().GetViewFrame()->GetBindings().SetState(rNewColorItem); } else { - aBrushItem.SetColor(COL_TRANSPARENT); + aBrushItem->SetColor(COL_TRANSPARENT); rReq.AppendItem(SvxColorItem(COL_TRANSPARENT,nSlot)); } break; @@ -2314,8 +2317,7 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq) case RES_BACKGROUND: { assert(pArgs && "only SID_BACKGROUND_COLOR can have !pArgs, checked at entry"); - const SvxBrushItem& rNewBrushItem = static_cast<const SvxBrushItem&>(pArgs->Get(GetPool().GetWhich(nSlot))); - aBrushItem = rNewBrushItem; + aBrushItem.reset(static_cast<SvxBrushItem*>(pArgs->Get(GetPool().GetWhich(nSlot)).Clone())); break; } default: @@ -2328,7 +2330,7 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq) if ( nSlot == SID_TABLE_CELL_BACKGROUND_COLOR ) { - rSh.SetBoxBackground( aBrushItem ); + rSh.SetBoxBackground( *aBrushItem ); } else { @@ -2336,7 +2338,7 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq) SfxItemSet aCoreSet(GetPool(), svl::Items<XATTR_FILL_FIRST, XATTR_FILL_LAST>{}); aCoreSet.SetParent(&GetView().GetDocShell()->GetDoc()->GetDfltFrameFormat()->GetAttrSet()); - setSvxBrushItemAsFillAttributesToTargetSet(aBrushItem, aCoreSet); + setSvxBrushItemAsFillAttributesToTargetSet(*aBrushItem, aCoreSet); if((SelectionType::Frame & nSelType) || (SelectionType::Graphic & nSelType)) { @@ -2526,10 +2528,10 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) if ( rSh.IsTableMode() ) { // Get background attributes of the table and put it in the set - SvxBrushItem aBrush(RES_BACKGROUND); + std::shared_ptr<SvxBrushItem> aBrush; rSh.GetBoxBackground( aBrush ); pDlg.disposeAndReset(pFact->CreateSwBackgroundDialog(pMDI, aSet)); - aSet.Put( aBrush ); + aSet.Put( *aBrush ); if ( pDlg->Execute() == RET_OK ) { diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx index aae01e315673..66aa26277bfa 100644 --- a/sw/source/uibase/shells/drwtxtsh.cxx +++ b/sw/source/uibase/shells/drwtxtsh.cxx @@ -697,19 +697,19 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq) SfxItemSet aSet(pOLV->GetAttribs()); SvtScriptType nScript = pOLV->GetSelectedScriptType(); - SvxFontItem aSetDlgFont( RES_CHRATR_FONT ); + std::shared_ptr<SvxFontItem> aSetDlgFont(std::make_shared<SvxFontItem>(RES_CHRATR_FONT)); { SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() ); aSetItem.GetItemSet().Put( aSet, false ); const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript ); if( pI ) - aSetDlgFont = *static_cast<const SvxFontItem*>(pI); + aSetDlgFont.reset(static_cast<SvxFontItem*>(pI->Clone())); else - aSetDlgFont = static_cast<const SvxFontItem&>(aSet.Get( GetWhichOfScript( + aSetDlgFont.reset(static_cast<SvxFontItem*>(aSet.Get( GetWhichOfScript( SID_ATTR_CHAR_FONT, - SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ) ))); + SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ) )).Clone())); if (sFontName.isEmpty()) - sFontName = aSetDlgFont.GetFamilyName(); + sFontName = aSetDlgFont->GetFamilyName(); } vcl::Font aFont(sFontName, Size(1,1)); @@ -723,7 +723,7 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq) if( !sSymbolFont.isEmpty() ) aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) ); else - aAllSet.Put( SfxStringItem( SID_FONT_NAME, aSetDlgFont.GetFamilyName() ) ); + aAllSet.Put( SfxStringItem( SID_FONT_NAME, aSetDlgFont->GetFamilyName() ) ); // If character is selected, it can be shown SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx index 31a599b4defc..a1e18351d68b 100644 --- a/sw/source/uibase/shells/frmsh.cxx +++ b/sw/source/uibase/shells/frmsh.cxx @@ -1017,7 +1017,7 @@ void SwFrameShell::ExecFrameStyle(SfxRequest const & rReq) if (pPoolBoxItem == &rBoxItem) bDefault = true; - SvxBoxItem aBoxItem(rBoxItem); + std::shared_ptr<SvxBoxItem> aBoxItem(static_cast<SvxBoxItem*>(rBoxItem.Clone())); SvxBorderLine aBorderLine; const SfxPoolItem *pItem = nullptr; @@ -1030,16 +1030,16 @@ void SwFrameShell::ExecFrameStyle(SfxRequest const & rReq) { if (pArgs->GetItemState(RES_BOX, true, &pItem) == SfxItemState::SET) { - SvxBoxItem aNewBox(*static_cast<const SvxBoxItem *>(pItem)); + std::shared_ptr<SvxBoxItem> aNewBox(static_cast<SvxBoxItem*>(pItem->Clone())); const SvxBorderLine* pBorderLine; - if ((pBorderLine = aBoxItem.GetTop()) != nullptr) + if ((pBorderLine = aBoxItem->GetTop()) != nullptr) lcl_FrameGetMaxLineWidth(pBorderLine, aBorderLine); - if ((pBorderLine = aBoxItem.GetBottom()) != nullptr) + if ((pBorderLine = aBoxItem->GetBottom()) != nullptr) lcl_FrameGetMaxLineWidth(pBorderLine, aBorderLine); - if ((pBorderLine = aBoxItem.GetLeft()) != nullptr) + if ((pBorderLine = aBoxItem->GetLeft()) != nullptr) lcl_FrameGetMaxLineWidth(pBorderLine, aBorderLine); - if ((pBorderLine = aBoxItem.GetRight()) != nullptr) + if ((pBorderLine = aBoxItem->GetRight()) != nullptr) lcl_FrameGetMaxLineWidth(pBorderLine, aBorderLine); if(aBorderLine.GetOutWidth() == 0) @@ -1055,20 +1055,20 @@ void SwFrameShell::ExecFrameStyle(SfxRequest const & rReq) #endif { // TODO: should this copy 4 individual Dist instead? - aNewBox.SetAllDistances(rBoxItem.GetSmallestDistance()); + aNewBox->SetAllDistances(rBoxItem.GetSmallestDistance()); } aBoxItem = aNewBox; SvxBorderLine aDestBorderLine; - if( aBoxItem.GetTop() != nullptr ) - aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::TOP); - if( aBoxItem.GetBottom() != nullptr ) - aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM); - if( aBoxItem.GetLeft() != nullptr ) - aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::LEFT); - if( aBoxItem.GetRight() != nullptr ) - aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::RIGHT); + if( aBoxItem->GetTop() != nullptr ) + aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::TOP); + if( aBoxItem->GetBottom() != nullptr ) + aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM); + if( aBoxItem->GetLeft() != nullptr ) + aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::LEFT); + if( aBoxItem->GetRight() != nullptr ) + aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::RIGHT); } } break; @@ -1084,44 +1084,44 @@ void SwFrameShell::ExecFrameStyle(SfxRequest const & rReq) { aBorderLine = *(pLineItem->GetLine()); - if (!aBoxItem.GetTop() && !aBoxItem.GetBottom() && - !aBoxItem.GetLeft() && !aBoxItem.GetRight()) + if (!aBoxItem->GetTop() && !aBoxItem->GetBottom() && + !aBoxItem->GetLeft() && !aBoxItem->GetRight()) { - aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::TOP); - aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM); - aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::LEFT); - aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::RIGHT); + aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::TOP); + aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM); + aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::LEFT); + aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::RIGHT); } else { - if( aBoxItem.GetTop() ) + if( aBoxItem->GetTop() ) { - aBorderLine.SetColor( aBoxItem.GetTop()->GetColor() ); - aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::TOP); + aBorderLine.SetColor( aBoxItem->GetTop()->GetColor() ); + aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::TOP); } - if( aBoxItem.GetBottom() ) + if( aBoxItem->GetBottom() ) { - aBorderLine.SetColor( aBoxItem.GetBottom()->GetColor()); - aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM); + aBorderLine.SetColor( aBoxItem->GetBottom()->GetColor()); + aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM); } - if( aBoxItem.GetLeft() ) + if( aBoxItem->GetLeft() ) { - aBorderLine.SetColor( aBoxItem.GetLeft()->GetColor()); - aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::LEFT); + aBorderLine.SetColor( aBoxItem->GetLeft()->GetColor()); + aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::LEFT); } - if( aBoxItem.GetRight() ) + if( aBoxItem->GetRight() ) { - aBorderLine.SetColor(aBoxItem.GetRight()->GetColor()); - aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::RIGHT); + aBorderLine.SetColor(aBoxItem->GetRight()->GetColor()); + aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::RIGHT); } } } else { - aBoxItem.SetLine(nullptr, SvxBoxItemLine::TOP); - aBoxItem.SetLine(nullptr, SvxBoxItemLine::BOTTOM); - aBoxItem.SetLine(nullptr, SvxBoxItemLine::LEFT); - aBoxItem.SetLine(nullptr, SvxBoxItemLine::RIGHT); + aBoxItem->SetLine(nullptr, SvxBoxItemLine::TOP); + aBoxItem->SetLine(nullptr, SvxBoxItemLine::BOTTOM); + aBoxItem->SetLine(nullptr, SvxBoxItemLine::LEFT); + aBoxItem->SetLine(nullptr, SvxBoxItemLine::RIGHT); } } } @@ -1133,37 +1133,37 @@ void SwFrameShell::ExecFrameStyle(SfxRequest const & rReq) { const Color& rNewColor = static_cast<const SvxColorItem*>(pItem)->GetValue(); - if (!aBoxItem.GetTop() && !aBoxItem.GetBottom() && - !aBoxItem.GetLeft() && !aBoxItem.GetRight()) + if (!aBoxItem->GetTop() && !aBoxItem->GetBottom() && + !aBoxItem->GetLeft() && !aBoxItem->GetRight()) { aBorderLine.SetColor( rNewColor ); - aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::TOP); - aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM); - aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::LEFT); - aBoxItem.SetLine(&aBorderLine, SvxBoxItemLine::RIGHT); + aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::TOP); + aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM); + aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::LEFT); + aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::RIGHT); } else { - if ( aBoxItem.GetTop() ) - const_cast<SvxBorderLine*>(aBoxItem.GetTop())->SetColor( rNewColor ); - if ( aBoxItem.GetBottom() ) - const_cast<SvxBorderLine*>(aBoxItem.GetBottom())->SetColor( rNewColor ); - if ( aBoxItem.GetLeft() ) - const_cast<SvxBorderLine*>(aBoxItem.GetLeft())->SetColor( rNewColor ); - if ( aBoxItem.GetRight() ) - const_cast<SvxBorderLine*>(aBoxItem.GetRight())->SetColor( rNewColor ); + if ( aBoxItem->GetTop() ) + const_cast<SvxBorderLine*>(aBoxItem->GetTop())->SetColor( rNewColor ); + if ( aBoxItem->GetBottom() ) + const_cast<SvxBorderLine*>(aBoxItem->GetBottom())->SetColor( rNewColor ); + if ( aBoxItem->GetLeft() ) + const_cast<SvxBorderLine*>(aBoxItem->GetLeft())->SetColor( rNewColor ); + if ( aBoxItem->GetRight() ) + const_cast<SvxBorderLine*>(aBoxItem->GetRight())->SetColor( rNewColor ); } } } break; } } - if (bDefault && (aBoxItem.GetTop() || aBoxItem.GetBottom() || - aBoxItem.GetLeft() || aBoxItem.GetRight())) + if (bDefault && (aBoxItem->GetTop() || aBoxItem->GetBottom() || + aBoxItem->GetLeft() || aBoxItem->GetRight())) { - aBoxItem.SetAllDistances(MIN_BORDER_DIST); + aBoxItem->SetAllDistances(MIN_BORDER_DIST); } - aFrameSet.Put( aBoxItem ); + aFrameSet.Put( *aBoxItem ); // Template AutoUpdate SwFrameFormat* pFormat = rSh.GetSelectedFrameFormat(); if(pFormat && pFormat->IsAutoUpdateFormat()) diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index 4333c01637f3..ef892924fc27 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -155,24 +155,24 @@ static SwTableRep* lcl_TableParamToItemSet( SfxItemSet& rSet, SwWrtShell &rSh ) const sal_uInt16 nBackgroundDestination = rSh.GetViewOptions()->GetTableDest(); rSet.Put(SfxUInt16Item(SID_BACKGRND_DESTINATION, nBackgroundDestination )); - SvxBrushItem aBrush( RES_BACKGROUND ); + std::shared_ptr<SvxBrushItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND)); if(rSh.GetRowBackground(aBrush)) { - aBrush.SetWhich(SID_ATTR_BRUSH_ROW); - rSet.Put( aBrush ); + aBrush->SetWhich(SID_ATTR_BRUSH_ROW); + rSet.Put( *aBrush ); } else rSet.InvalidateItem(SID_ATTR_BRUSH_ROW); rSh.GetTabBackground(aBrush); - aBrush.SetWhich(SID_ATTR_BRUSH_TABLE); - rSet.Put( aBrush ); + aBrush->SetWhich(SID_ATTR_BRUSH_TABLE); + rSet.Put( *aBrush ); // text direction in boxes - SvxFrameDirectionItem aBoxDirection( SvxFrameDirection::Environment, RES_FRAMEDIR ); + std::shared_ptr<SvxFrameDirectionItem> aBoxDirection(std::make_shared<SvxFrameDirectionItem>(SvxFrameDirection::Environment, RES_FRAMEDIR)); if(rSh.GetBoxDirection( aBoxDirection )) { - aBoxDirection.SetWhich(FN_TABLE_BOX_TEXTORIENTATION); - rSet.Put(aBoxDirection); + aBoxDirection->SetWhich(FN_TABLE_BOX_TEXTORIENTATION); + rSet.Put(*aBoxDirection); } bool bSelectAll = rSh.StartsWithTable() && rSh.ExtendedSelectedAll(); @@ -310,15 +310,15 @@ void ItemSetToTableParam( const SfxItemSet& rSet, rSh.SetBoxBackground( *static_cast<const SvxBrushItem*>(pItem) ); if(pRowItem) { - SvxBrushItem aBrush(*static_cast<const SvxBrushItem*>(pRowItem)); - aBrush.SetWhich(RES_BACKGROUND); - rSh.SetRowBackground(aBrush); + std::shared_ptr<SvxBrushItem> aBrush(static_cast<SvxBrushItem*>(pRowItem->Clone())); + aBrush->SetWhich(RES_BACKGROUND); + rSh.SetRowBackground(*aBrush); } if(pTableItem) { - SvxBrushItem aBrush(*static_cast<const SvxBrushItem*>(pTableItem)); - aBrush.SetWhich(RES_BACKGROUND); - rSh.SetTabBackground( aBrush ); + std::shared_ptr<SvxBrushItem> aBrush(static_cast<SvxBrushItem*>(pTableItem->Clone())); + aBrush->SetWhich(RES_BACKGROUND); + rSh.SetTabBackground( *aBrush ); } } @@ -469,7 +469,7 @@ void SwTableShell::Execute(SfxRequest &rReq) if(!pArgs) break; // Create items, because we have to rework anyway. - SvxBoxItem aBox( RES_BOX ); + std::shared_ptr<SvxBoxItem> aBox(std::make_shared<SvxBoxItem>(RES_BOX)); SfxItemSet aCoreSet( GetPool(), svl::Items<RES_BOX, RES_BOX, SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER>{}); @@ -480,31 +480,33 @@ void SwTableShell::Execute(SfxRequest &rReq) const SfxPoolItem *pBoxItem = nullptr; if ( pArgs->GetItemState(RES_BOX, true, &pBoxItem) == SfxItemState::SET ) { - aBox = *static_cast<const SvxBoxItem*>(pBoxItem); + aBox.reset(static_cast<SvxBoxItem*>(pBoxItem->Clone())); sal_uInt16 nDefValue = MIN_BORDER_DIST; if ( !rReq.IsAPI() ) nDefValue = 55; - if (!rReq.IsAPI() || aBox.GetSmallestDistance() < MIN_BORDER_DIST) + if (!rReq.IsAPI() || aBox->GetSmallestDistance() < MIN_BORDER_DIST) { for( SvxBoxItemLine k : o3tl::enumrange<SvxBoxItemLine>() ) - aBox.SetDistance( std::max(rCoreBox.GetDistance(k), nDefValue) , k ); + aBox->SetDistance( std::max(rCoreBox.GetDistance(k), nDefValue) , k ); } } else OSL_ENSURE( false, "where is BoxItem?" ); //since the drawing layer also supports borders the which id might be a different one - SvxBoxInfoItem aInfo( SID_ATTR_BORDER_INNER ); + std::shared_ptr<SvxBoxInfoItem> aInfo(std::make_shared<SvxBoxInfoItem>(SID_ATTR_BORDER_INNER)); if (pArgs->GetItemState(SID_ATTR_BORDER_INNER, true, &pBoxItem) == SfxItemState::SET) - aInfo = *static_cast<const SvxBoxInfoItem*>(pBoxItem); + { + aInfo.reset(static_cast<SvxBoxInfoItem*>(pBoxItem->Clone())); + } else if( pArgs->GetItemState(SDRATTR_TABLE_BORDER_INNER, true, &pBoxItem) == SfxItemState::SET ) { - aInfo = *static_cast<const SvxBoxInfoItem*>(pBoxItem); - aInfo.SetWhich(SID_ATTR_BORDER_INNER); + aInfo.reset(static_cast<SvxBoxInfoItem*>(pBoxItem->Clone())); + aInfo->SetWhich(SID_ATTR_BORDER_INNER); } - aInfo.SetTable( true ); - aInfo.SetValid( SvxBoxInfoItemValidFlags::DISABLE, false ); + aInfo->SetTable( true ); + aInfo->SetValid( SvxBoxInfoItemValidFlags::DISABLE, false ); // The attributes of all lines will be read and the strongest wins. const SvxBorderLine* pBorderLine; @@ -528,40 +530,40 @@ void SwTableShell::Execute(SfxRequest &rReq) aBorderLine.SetWidth( DEF_LINE_WIDTH_5 ); } - if( aBox.GetTop() != nullptr ) + if( aBox->GetTop() != nullptr ) { - aBox.SetLine(&aBorderLine, SvxBoxItemLine::TOP); + aBox->SetLine(&aBorderLine, SvxBoxItemLine::TOP); } - if( aBox.GetBottom() != nullptr ) + if( aBox->GetBottom() != nullptr ) { - aBox.SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM); + aBox->SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM); } - if( aBox.GetLeft() != nullptr ) + if( aBox->GetLeft() != nullptr ) { - aBox.SetLine(&aBorderLine, SvxBoxItemLine::LEFT); + aBox->SetLine(&aBorderLine, SvxBoxItemLine::LEFT); } - if( aBox.GetRight() != nullptr ) + if( aBox->GetRight() != nullptr ) { - aBox.SetLine(&aBorderLine, SvxBoxItemLine::RIGHT); + aBox->SetLine(&aBorderLine, SvxBoxItemLine::RIGHT); } - if( aInfo.GetHori() != nullptr ) + if( aInfo->GetHori() != nullptr ) { - aInfo.SetLine(&aBorderLine, SvxBoxInfoItemLine::HORI); + aInfo->SetLine(&aBorderLine, SvxBoxInfoItemLine::HORI); } - if( aInfo.GetVert() != nullptr ) + if( aInfo->GetVert() != nullptr ) { - aInfo.SetLine(&aBorderLine, SvxBoxInfoItemLine::VERT); + aInfo->SetLine(&aBorderLine, SvxBoxInfoItemLine::VERT); } - aCoreSet.Put( aBox ); - aCoreSet.Put( aInfo ); + aCoreSet.Put( *aBox ); + aCoreSet.Put( *aInfo ); rSh.SetTabBorders( aCoreSet ); // we must record the "real" values because otherwise the lines can't be reconstructed on playtime // the coding style of the controller (setting lines with width 0) is not transportable via Query/PutValue in // the SvxBoxItem - rReq.AppendItem( aBox ); - rReq.AppendItem( aInfo ); + rReq.AppendItem( *aBox ); + rReq.AppendItem( *aInfo ); bCallDone = true; break; } @@ -582,9 +584,9 @@ void SwTableShell::Execute(SfxRequest &rReq) aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell()))); rSh.GetTableAttr(aCoreSet); // GetTableAttr overwrites the background! - SvxBrushItem aBrush( RES_BACKGROUND ); + std::shared_ptr<SvxBrushItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND)); if(rSh.GetBoxBackground(aBrush)) - aCoreSet.Put( aBrush ); + aCoreSet.Put( *aBrush ); else aCoreSet.InvalidateItem( RES_BACKGROUND ); diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx index 3b7b5d41d57e..20fad8442156 100644 --- a/sw/source/uibase/shells/textsh.cxx +++ b/sw/source/uibase/shells/textsh.cxx @@ -905,21 +905,26 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) rSh.GetCurAttr( aSet ); SvtScriptType nScript = rSh.GetScriptType(); - SvxFontItem aFont( RES_CHRATR_FONT ); + std::shared_ptr<SvxFontItem> aFont(std::make_shared<SvxFontItem>(RES_CHRATR_FONT)); { SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() ); aSetItem.GetItemSet().Put( aSet, false ); const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript ); if( pI ) - aFont = *static_cast<const SvxFontItem*>(pI); + { + aFont.reset(static_cast<SvxFontItem*>(pI->Clone())); + } else - aFont = static_cast<const SvxFontItem&>( + { + aFont.reset(static_cast<SvxFontItem*>( aSet.Get( GetWhichOfScript( RES_CHRATR_FONT, - SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ) ))); + SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ) )).Clone())); + } + if (aFontName.isEmpty()) - aFontName = aFont.GetFamilyName(); + aFontName = aFont->GetFamilyName(); } vcl::Font aNewFont(aFontName, Size(1,1)); // Size only because CTOR. @@ -934,7 +939,7 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) if( aFontName.isEmpty() && !sSymbolFont.isEmpty() ) aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) ); else - aAllSet.Put( SfxStringItem( SID_FONT_NAME, aFont.GetFamilyName() ) ); + aAllSet.Put( SfxStringItem( SID_FONT_NAME, aFont->GetFamilyName() ) ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(GetView().GetFrameWeld(), aAllSet, true)); @@ -961,11 +966,15 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) aSetItem.GetItemSet().Put( aSet, false ); const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript ); if( pI ) - aFont = *static_cast<const SvxFontItem*>(pI); + { + aFont.reset(static_cast<SvxFontItem*>(pI->Clone())); + } else - aFont = static_cast<const SvxFontItem&>(aSet.Get( GetWhichOfScript( + { + aFont.reset(static_cast<SvxFontItem*>(aSet.Get( GetWhichOfScript( RES_CHRATR_FONT, - SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ) ))); + SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ) )).Clone())); + } } // Insert character. @@ -974,11 +983,11 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) // #108876# a font attribute has to be set always due to a guessed script type if( !aNewFont.GetFamilyName().isEmpty() ) { - SvxFontItem aNewFontItem( aFont ); - aNewFontItem.SetFamilyName( aNewFont.GetFamilyName() ); - aNewFontItem.SetFamily( aNewFont.GetFamilyType()); - aNewFontItem.SetPitch( aNewFont.GetPitch()); - aNewFontItem.SetCharSet( aNewFont.GetCharSet() ); + std::shared_ptr<SvxFontItem> aNewFontItem(static_cast<SvxFontItem*>(aFont->Clone())); + aNewFontItem->SetFamilyName( aNewFont.GetFamilyName() ); + aNewFontItem->SetFamily( aNewFont.GetFamilyType()); + aNewFontItem->SetPitch( aNewFont.GetPitch()); + aNewFontItem->SetCharSet( aNewFont.GetCharSet() ); SfxItemSet aRestoreSet( GetPool(), svl::Items<RES_CHRATR_FONT, RES_CHRATR_FONT, RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_FONT, @@ -988,20 +997,20 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) if( SvtScriptType::LATIN & nScript ) { aRestoreSet.Put( aSet.Get( RES_CHRATR_FONT ) ); - aNewFontItem.SetWhich(RES_CHRATR_FONT); - aSet.Put( aNewFontItem ); + aNewFontItem->SetWhich(RES_CHRATR_FONT); + aSet.Put( *aNewFontItem ); } if( SvtScriptType::ASIAN & nScript ) { aRestoreSet.Put( aSet.Get( RES_CHRATR_CJK_FONT ) ); - aNewFontItem.SetWhich(RES_CHRATR_CJK_FONT); - aSet.Put( aNewFontItem ); + aNewFontItem->SetWhich(RES_CHRATR_CJK_FONT); + aSet.Put( *aNewFontItem ); } if( SvtScriptType::COMPLEX & nScript ) { aRestoreSet.Put( aSet.Get( RES_CHRATR_CTL_FONT ) ); - aNewFontItem.SetWhich(RES_CHRATR_CTL_FONT); - aSet.Put( aNewFontItem ); + aNewFontItem->SetWhich(RES_CHRATR_CTL_FONT); + aSet.Put( *aNewFontItem ); } rSh.SetMark(); @@ -1020,7 +1029,10 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) rSh.ClearMark(); rSh.UpdateAttr(); - aFont = aNewFontItem; + + // Why was this done? aFont is not used anymore below, we are not + // in a loop and it's a local variable...? + // aFont = aNewFontItem; } rSh.EndAllAction(); diff --git a/sw/source/uibase/uiview/formatclipboard.cxx b/sw/source/uibase/uiview/formatclipboard.cxx index 76cadb99a208..f8f95205dbf6 100644 --- a/sw/source/uibase/uiview/formatclipboard.cxx +++ b/sw/source/uibase/uiview/formatclipboard.cxx @@ -98,29 +98,29 @@ std::unique_ptr<SfxItemSet> lcl_CreateEmptyItemSet( SelectionType nSelectionType void lcl_getTableAttributes( SfxItemSet& rSet, SwWrtShell &rSh ) { - SvxBrushItem aBrush( RES_BACKGROUND ); + std::shared_ptr<SvxBrushItem> aBrush(std::make_shared<SvxBrushItem>(RES_BACKGROUND)); rSh.GetBoxBackground(aBrush); - rSet.Put( aBrush ); + rSet.Put( *aBrush ); if(rSh.GetRowBackground(aBrush)) { - aBrush.SetWhich(SID_ATTR_BRUSH_ROW); - rSet.Put( aBrush ); + aBrush->SetWhich(SID_ATTR_BRUSH_ROW); + rSet.Put( *aBrush ); } else rSet.InvalidateItem(SID_ATTR_BRUSH_ROW); rSh.GetTabBackground(aBrush); - aBrush.SetWhich(SID_ATTR_BRUSH_TABLE); - rSet.Put( aBrush ); + aBrush->SetWhich(SID_ATTR_BRUSH_TABLE); + rSet.Put( *aBrush ); SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER ); rSet.Put(aBoxInfo); rSh.GetTabBorders( rSet ); - SvxFrameDirectionItem aBoxDirection( SvxFrameDirection::Environment, RES_FRAMEDIR ); + std::shared_ptr<SvxFrameDirectionItem> aBoxDirection(std::make_shared<SvxFrameDirectionItem>(SvxFrameDirection::Environment, RES_FRAMEDIR)); if(rSh.GetBoxDirection( aBoxDirection )) { - aBoxDirection.SetWhich(FN_TABLE_BOX_TEXTORIENTATION); - rSet.Put(aBoxDirection); + aBoxDirection->SetWhich(FN_TABLE_BOX_TEXTORIENTATION); + rSet.Put(*aBoxDirection); } rSet.Put(SfxUInt16Item(FN_TABLE_SET_VERT_ALIGN, rSh.GetBoxAlign())); @@ -159,15 +159,15 @@ void lcl_setTableAttributes( const SfxItemSet& rSet, SwWrtShell &rSh ) rSh.SetBoxBackground( *static_cast<const SvxBrushItem*>(pItem) ); if(pRowItem) { - SvxBrushItem aBrush(*static_cast<const SvxBrushItem*>(pRowItem)); - aBrush.SetWhich(RES_BACKGROUND); - rSh.SetRowBackground(aBrush); + std::shared_ptr<SvxBrushItem> aBrush(static_cast<SvxBrushItem*>(pRowItem->Clone())); + aBrush->SetWhich(RES_BACKGROUND); + rSh.SetRowBackground(*aBrush); } if(pTableItem) { - SvxBrushItem aBrush(*static_cast<const SvxBrushItem*>(pTableItem)); - aBrush.SetWhich(RES_BACKGROUND); - rSh.SetTabBackground( aBrush ); + std::shared_ptr<SvxBrushItem> aBrush(static_cast<SvxBrushItem*>(pTableItem->Clone())); + aBrush->SetWhich(RES_BACKGROUND); + rSh.SetTabBackground(*aBrush); } } if(bBorder) diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx index f59d3103c75e..39e056cc0b2f 100644 --- a/sw/source/uibase/uiview/viewtab.cxx +++ b/sw/source/uibase/uiview/viewtab.cxx @@ -721,25 +721,24 @@ void SwView::ExecTabWin( SfxRequest const & rReq ) if ( i >= rTabStops.Count() ) { // No DefTab - SvxTabStopItem aTabStops( RES_PARATR_TABSTOP ); - aTabStops = rTabStops; + std::shared_ptr<SvxTabStopItem> aTabStops(static_cast<SvxTabStopItem*>(rTabStops.Clone())); - ::lcl_EraseDefTabs(aTabStops); + ::lcl_EraseDefTabs(*aTabStops); SvxTabStop aSwTabStop( 0, SvxTabAdjust::Default ); - aTabStops.Insert(aSwTabStop); + aTabStops->Insert(aSwTabStop); const SvxTabStopItem& rDefTabs = rSh.GetDefault(RES_PARATR_TABSTOP); - ::MakeDefTabs( ::GetTabDist(rDefTabs), aTabStops ); + ::MakeDefTabs( ::GetTabDist(rDefTabs), *aTabStops ); if( pColl && pColl->IsAutoUpdateFormat()) { SfxItemSet aSetTmp(GetPool(), svl::Items<RES_PARATR_TABSTOP, RES_PARATR_TABSTOP>{}); - aSetTmp.Put(aTabStops); + aSetTmp.Put(*aTabStops); rSh.AutoUpdatePara( pColl, aSetTmp ); } else - rSh.SetAttrItem( aTabStops ); + rSh.SetAttrItem( *aTabStops ); } } } @@ -1453,15 +1452,15 @@ void SwView::StateTabWin(SfxItemSet& rSet) } else { - SvxLRSpaceItem aLR( RES_LR_SPACE ); + std::shared_ptr<SvxLRSpaceItem> aLR(std::make_shared<SvxLRSpaceItem>(RES_LR_SPACE)); if ( !IsTabColFromDoc() ) { - aLR = aCoreSet.Get(RES_LR_SPACE); + aLR.reset(static_cast<SvxLRSpaceItem*>(aCoreSet.Get(RES_LR_SPACE).Clone())); // #i23726# if (m_pNumRuleNodeFromDoc) { - short nOffset = static_cast< short >(aLR.GetTextLeft() + + short nOffset = static_cast< short >(aLR->GetTextLeft() + // #i42922# Mouse move of numbering label // has to consider the left indent of the paragraph m_pNumRuleNodeFromDoc->GetLeftMarginWithNum( true ) ); @@ -1469,11 +1468,11 @@ void SwView::StateTabWin(SfxItemSet& rSet) short nFLOffset; m_pNumRuleNodeFromDoc->GetFirstLineOfsWithNum( nFLOffset ); - aLR.SetLeft( nOffset + nFLOffset ); + aLR->SetLeft( nOffset + nFLOffset ); } } - aLR.SetWhich(nWhich); - rSet.Put(aLR); + aLR->SetWhich(nWhich); + rSet.Put(*aLR); } break; } diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index af7a34ca2e80..7aac5d6094c4 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -1115,7 +1115,7 @@ sal_Int8 SwNavigationPI::ExecuteDrop( const ExecuteDropEvent& rEvt ) m_pxObjectShell.reset(); } SfxStringItem aFileItem(SID_FILE_NAME, sFileName ); - SfxStringItem aOptionsItem( SID_OPTIONS, OUString("HRC") ); + SfxStringItem aOptionsItem( SID_OPTIONS, "HRC" ); SfxLinkItem aLink( SID_DONELINK, LINK( this, SwNavigationPI, DoneLink ) ); GetActiveView()->GetViewFrame()->GetDispatcher()->ExecuteList( diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx index 2c84af61fd53..c44434b25961 100644 --- a/sw/source/uibase/utlui/uitool.cxx +++ b/sw/source/uibase/utlui/uitool.cxx @@ -101,25 +101,27 @@ void SetMetric(MetricFormatter& rCtrl, FieldUnit eUnit) void PrepareBoxInfo(SfxItemSet& rSet, const SwWrtShell& rSh) { - SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER ); + std::shared_ptr<SvxBoxInfoItem> aBoxInfo(std::make_shared<SvxBoxInfoItem>(SID_ATTR_BORDER_INNER)); const SfxPoolItem *pBoxInfo; - if ( SfxItemState::SET == rSet.GetItemState( SID_ATTR_BORDER_INNER, - true, &pBoxInfo)) - aBoxInfo = *static_cast<const SvxBoxInfoItem*>(pBoxInfo); + + if ( SfxItemState::SET == rSet.GetItemState( SID_ATTR_BORDER_INNER, true, &pBoxInfo)) + { + aBoxInfo.reset(static_cast<SvxBoxInfoItem*>(pBoxInfo->Clone())); + } // Table variant: If more than one table cells are selected rSh.GetCursor(); //So that GetCursorCnt() returns the right thing - aBoxInfo.SetTable (rSh.IsTableMode() && rSh.GetCursorCnt() > 1); + aBoxInfo->SetTable (rSh.IsTableMode() && rSh.GetCursorCnt() > 1); // Always show the distance field - aBoxInfo.SetDist (true); + aBoxInfo->SetDist (true); // Set minimal size in tables and paragraphs - aBoxInfo.SetMinDist (rSh.IsTableMode() || rSh.GetSelectionType() & (SelectionType::Text | SelectionType::Table)); + aBoxInfo->SetMinDist (rSh.IsTableMode() || rSh.GetSelectionType() & (SelectionType::Text | SelectionType::Table)); // Set always the default distance - aBoxInfo.SetDefDist (MIN_BORDER_DIST); + aBoxInfo->SetDefDist (MIN_BORDER_DIST); // Single lines can have only in tables DontCare-Status - aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::DISABLE, !rSh.IsTableMode()); + aBoxInfo->SetValid(SvxBoxInfoItemValidFlags::DISABLE, !rSh.IsTableMode()); - rSet.Put(aBoxInfo); + rSet.Put(*aBoxInfo); } void ConvertAttrCharToGen(SfxItemSet& rSet) @@ -427,22 +429,24 @@ void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet) // Margins, border and the other stuff. rSet.Put(rMaster.GetAttrSet()); - SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER ); + std::shared_ptr<SvxBoxInfoItem> aBoxInfo(std::make_shared<SvxBoxInfoItem>(SID_ATTR_BORDER_INNER)); const SfxPoolItem *pBoxInfo; - if ( SfxItemState::SET == rSet.GetItemState( SID_ATTR_BORDER_INNER, - true, &pBoxInfo) ) - aBoxInfo = *static_cast<const SvxBoxInfoItem*>(pBoxInfo); - aBoxInfo.SetTable( false ); + if ( SfxItemState::SET == rSet.GetItemState( SID_ATTR_BORDER_INNER, true, &pBoxInfo) ) + { + aBoxInfo.reset(static_cast<SvxBoxInfoItem*>(pBoxInfo->Clone())); + } + + aBoxInfo->SetTable( false ); // Show always the distance field - aBoxInfo.SetDist( true); + aBoxInfo->SetDist( true); // Set minimal size in tables and paragraphs - aBoxInfo.SetMinDist( false ); + aBoxInfo->SetMinDist( false ); // Set always the default distance - aBoxInfo.SetDefDist( MIN_BORDER_DIST ); + aBoxInfo->SetDefDist( MIN_BORDER_DIST ); // Single lines can have only in tables DontCare-Status - aBoxInfo.SetValid( SvxBoxInfoItemValidFlags::DISABLE ); - rSet.Put( aBoxInfo ); + aBoxInfo->SetValid( SvxBoxInfoItemValidFlags::DISABLE ); + rSet.Put( *aBoxInfo ); SfxStringItem aFollow(SID_ATTR_PAGE_EXT1, OUString()); if(rPageDesc.GetFollow()) @@ -492,7 +496,7 @@ void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet) // Shifting frame attributes aHeaderSet.Put(pHeaderFormat->GetAttrSet()); - aHeaderSet.Put( aBoxInfo ); + aHeaderSet.Put( *aBoxInfo ); // Create SetItem SvxSetItem aSetItem(SID_ATTR_PAGE_HEADERSET, aHeaderSet); @@ -542,7 +546,7 @@ void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet) // Shifting Frame attributes aFooterSet.Put(pFooterFormat->GetAttrSet()); - aFooterSet.Put( aBoxInfo ); + aFooterSet.Put( *aBoxInfo ); // Create SetItem SvxSetItem aSetItem(SID_ATTR_PAGE_FOOTERSET, aFooterSet); |