diff options
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/styles/CommonStylePreviewRenderer.cxx | 36 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 35 |
2 files changed, 38 insertions, 33 deletions
diff --git a/svx/source/styles/CommonStylePreviewRenderer.cxx b/svx/source/styles/CommonStylePreviewRenderer.cxx index ab1271ac8fe0..67f9b89670a5 100644 --- a/svx/source/styles/CommonStylePreviewRenderer.cxx +++ b/svx/source/styles/CommonStylePreviewRenderer.cxx @@ -60,65 +60,67 @@ CommonStylePreviewRenderer::~CommonStylePreviewRenderer() bool CommonStylePreviewRenderer::recalculate() { - const SfxItemSet& aItemSet = mpStyle->GetItemSet(); - maFont = SvxFont(); + std::unique_ptr<SfxItemSet> pItemSet(mpStyle->GetItemSetForPreview()); + + if (!pItemSet) return false; + const SfxPoolItem* pItem; - if ((pItem = aItemSet.GetItem(SID_ATTR_CHAR_WEIGHT)) != nullptr) + if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_WEIGHT)) != nullptr) { maFont.SetWeight(static_cast<const SvxWeightItem*>(pItem)->GetWeight()); } - if ((pItem = aItemSet.GetItem(SID_ATTR_CHAR_POSTURE)) != nullptr) + if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_POSTURE)) != nullptr) { maFont.SetItalic(static_cast<const SvxPostureItem*>(pItem)->GetPosture()); } - if ((pItem = aItemSet.GetItem(SID_ATTR_CHAR_CONTOUR)) != nullptr) + if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_CONTOUR)) != nullptr) { maFont.SetOutline(static_cast< const SvxContourItem*>(pItem)->GetValue()); } - if ((pItem = aItemSet.GetItem(SID_ATTR_CHAR_SHADOWED)) != nullptr) + if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_SHADOWED)) != nullptr) { maFont.SetShadow(static_cast<const SvxShadowedItem*>(pItem)->GetValue()); } - if ((pItem = aItemSet.GetItem(SID_ATTR_CHAR_RELIEF)) != nullptr) + if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_RELIEF)) != nullptr) { maFont.SetRelief(static_cast<FontRelief>(static_cast<const SvxCharReliefItem*>(pItem)->GetValue())); } - if ((pItem = aItemSet.GetItem(SID_ATTR_CHAR_UNDERLINE)) != nullptr) + if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_UNDERLINE)) != nullptr) { maFont.SetUnderline(static_cast< const SvxUnderlineItem*>(pItem)->GetLineStyle()); } - if ((pItem = aItemSet.GetItem(SID_ATTR_CHAR_OVERLINE)) != nullptr) + if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_OVERLINE)) != nullptr) { maFont.SetOverline(static_cast<FontUnderline>(static_cast<const SvxOverlineItem*>(pItem)->GetValue())); } - if ((pItem = aItemSet.GetItem(SID_ATTR_CHAR_STRIKEOUT)) != nullptr) + if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_STRIKEOUT)) != nullptr) { maFont.SetStrikeout(static_cast<const SvxCrossedOutItem*>(pItem)->GetStrikeout()); } - if ((pItem = aItemSet.GetItem(SID_ATTR_CHAR_CASEMAP)) != nullptr) + if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_CASEMAP)) != nullptr) { maFont.SetCaseMap(static_cast<const SvxCaseMapItem*>(pItem)->GetCaseMap()); } - if ((pItem = aItemSet.GetItem(SID_ATTR_CHAR_EMPHASISMARK)) != nullptr) + if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_EMPHASISMARK)) != nullptr) { maFont.SetEmphasisMark(static_cast<const SvxEmphasisMarkItem*>(pItem)->GetEmphasisMark()); } - if ((pItem = aItemSet.GetItem(SID_ATTR_CHAR_COLOR)) != nullptr) + if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_COLOR)) != nullptr) { maFontColor = Color(static_cast<const SvxColorItem*>(pItem)->GetValue()); } if (mpStyle->GetFamily() == SFX_STYLE_FAMILY_PARA) { - if ((pItem = aItemSet.GetItem(XATTR_FILLSTYLE)) != nullptr) + if ((pItem = pItemSet->GetItem(XATTR_FILLSTYLE)) != nullptr) { sal_uInt16 aFillStyle = static_cast<const XFillStyleItem*>(pItem)->GetValue(); if (aFillStyle == drawing::FillStyle_SOLID) { - if ((pItem = aItemSet.GetItem(XATTR_FILLCOLOR)) != nullptr) + if ((pItem = pItemSet->GetItem(XATTR_FILLCOLOR)) != nullptr) { maBackgroundColor = Color(static_cast<const XFillColorItem*>(pItem)->GetColorValue()); } @@ -126,7 +128,7 @@ bool CommonStylePreviewRenderer::recalculate() } } - if ((pItem = aItemSet.GetItem(SID_ATTR_CHAR_FONT)) != nullptr) + if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_FONT)) != nullptr) { const SvxFontItem* pFontItem = static_cast<const SvxFontItem*>(pItem); maFont.SetName(pFontItem->GetFamilyName()); @@ -137,7 +139,7 @@ bool CommonStylePreviewRenderer::recalculate() return false; } - if ((pItem = aItemSet.GetItem(SID_ATTR_CHAR_FONTHEIGHT)) != nullptr) + if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_FONTHEIGHT)) != nullptr) { const SvxFontHeightItem* pFontHeightItem = static_cast<const SvxFontHeightItem*>(pItem); Size aFontSize(0, pFontHeightItem->GetHeight()); diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index e22c6c67aa98..5e15ccd61f25 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -639,10 +639,13 @@ void SvxStyleBox_Impl::SetupEntry(vcl::RenderContext& rRenderContext, vcl::Windo if (pStyle ) { - const SfxItemSet& aItemSet = pStyle->GetItemSet(); + std::unique_ptr<const SfxItemSet> const pItemSet(pStyle->GetItemSetForPreview()); + if (!pItemSet) return; - const SvxFontItem *pFontItem = static_cast< const SvxFontItem* >( aItemSet.GetItem( SID_ATTR_CHAR_FONT ) ); - const SvxFontHeightItem *pFontHeightItem = static_cast< const SvxFontHeightItem* >( aItemSet.GetItem( SID_ATTR_CHAR_FONTHEIGHT ) ); + const SvxFontItem * const pFontItem = + static_cast<const SvxFontItem*>(pItemSet->GetItem(SID_ATTR_CHAR_FONT)); + const SvxFontHeightItem * const pFontHeightItem = + static_cast<const SvxFontHeightItem*>(pItemSet->GetItem(SID_ATTR_CHAR_FONTHEIGHT)); if ( pFontItem && pFontHeightItem ) { @@ -655,43 +658,43 @@ void SvxStyleBox_Impl::SetupEntry(vcl::RenderContext& rRenderContext, vcl::Windo aFont.SetStyleName(pFontItem->GetStyleName()); aFont.SetSize(aPixelSize); - const SfxPoolItem *pItem = aItemSet.GetItem( SID_ATTR_CHAR_WEIGHT ); + const SfxPoolItem *pItem = pItemSet->GetItem( SID_ATTR_CHAR_WEIGHT ); if ( pItem ) aFont.SetWeight( static_cast< const SvxWeightItem* >( pItem )->GetWeight() ); - pItem = aItemSet.GetItem( SID_ATTR_CHAR_POSTURE ); + pItem = pItemSet->GetItem( SID_ATTR_CHAR_POSTURE ); if ( pItem ) aFont.SetItalic( static_cast< const SvxPostureItem* >( pItem )->GetPosture() ); - pItem = aItemSet.GetItem( SID_ATTR_CHAR_CONTOUR ); + pItem = pItemSet->GetItem( SID_ATTR_CHAR_CONTOUR ); if ( pItem ) aFont.SetOutline( static_cast< const SvxContourItem* >( pItem )->GetValue() ); - pItem = aItemSet.GetItem( SID_ATTR_CHAR_SHADOWED ); + pItem = pItemSet->GetItem( SID_ATTR_CHAR_SHADOWED ); if ( pItem ) aFont.SetShadow( static_cast< const SvxShadowedItem* >( pItem )->GetValue() ); - pItem = aItemSet.GetItem( SID_ATTR_CHAR_RELIEF ); + pItem = pItemSet->GetItem( SID_ATTR_CHAR_RELIEF ); if ( pItem ) aFont.SetRelief( static_cast< FontRelief >( static_cast< const SvxCharReliefItem* >( pItem )->GetValue() ) ); - pItem = aItemSet.GetItem( SID_ATTR_CHAR_UNDERLINE ); + pItem = pItemSet->GetItem( SID_ATTR_CHAR_UNDERLINE ); if ( pItem ) aFont.SetUnderline( static_cast< const SvxUnderlineItem* >( pItem )->GetLineStyle() ); - pItem = aItemSet.GetItem( SID_ATTR_CHAR_OVERLINE ); + pItem = pItemSet->GetItem( SID_ATTR_CHAR_OVERLINE ); if ( pItem ) aFont.SetOverline( static_cast< FontUnderline >( static_cast< const SvxOverlineItem* >( pItem )->GetValue() ) ); - pItem = aItemSet.GetItem( SID_ATTR_CHAR_STRIKEOUT ); + pItem = pItemSet->GetItem( SID_ATTR_CHAR_STRIKEOUT ); if ( pItem ) aFont.SetStrikeout( static_cast< const SvxCrossedOutItem* >( pItem )->GetStrikeout() ); - pItem = aItemSet.GetItem( SID_ATTR_CHAR_CASEMAP ); + pItem = pItemSet->GetItem( SID_ATTR_CHAR_CASEMAP ); if ( pItem ) aFont.SetCaseMap(static_cast<const SvxCaseMapItem*>(pItem)->GetCaseMap()); - pItem = aItemSet.GetItem( SID_ATTR_CHAR_EMPHASISMARK ); + pItem = pItemSet->GetItem( SID_ATTR_CHAR_EMPHASISMARK ); if ( pItem ) aFont.SetEmphasisMark( static_cast< const SvxEmphasisMarkItem* >( pItem )->GetEmphasisMark() ); @@ -702,14 +705,14 @@ void SvxStyleBox_Impl::SetupEntry(vcl::RenderContext& rRenderContext, vcl::Windo rRenderContext.SetFont(aFont); - pItem = aItemSet.GetItem( SID_ATTR_CHAR_COLOR ); + pItem = pItemSet->GetItem( SID_ATTR_CHAR_COLOR ); // text color, when nothing is selected if ( (NULL != pItem) && bIsNotSelected) aFontCol = Color( static_cast< const SvxColorItem* >( pItem )->GetValue() ); sal_uInt16 style = drawing::FillStyle_NONE; // which kind of Fill style is selected - pItem = aItemSet.GetItem( XATTR_FILLSTYLE ); + pItem = pItemSet->GetItem( XATTR_FILLSTYLE ); // only when ok and not selected if ( (NULL != pItem) && bIsNotSelected) style = static_cast< const XFillStyleItem* >( pItem )->GetValue(); @@ -719,7 +722,7 @@ void SvxStyleBox_Impl::SetupEntry(vcl::RenderContext& rRenderContext, vcl::Windo case drawing::FillStyle_SOLID: { // set background color - pItem = aItemSet.GetItem( XATTR_FILLCOLOR ); + pItem = pItemSet->GetItem( XATTR_FILLCOLOR ); if ( NULL != pItem ) aBackCol = Color( static_cast< const XFillColorItem* >( pItem )->GetColorValue() ); |