summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-07-01 12:26:35 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-07-02 15:53:15 +0200
commit51f00abe7a17c91476375babaa69f4c7b1883c09 (patch)
treea327834dfa25e31425e58b657e9b8d887acee74e /svx
parent2024780f9e169a6c1d167e494d37f46f7640dc97 (diff)
no need to allocate return val on heap for GetItemSetForPreview
Change-Id: I261182ec2348df045171c5e1beb33579e2c0c766 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118284 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/styles/CommonStylePreviewRenderer.cxx2
-rw-r--r--svx/source/tbxctrls/StylesPreviewWindow.cxx13
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx2
3 files changed, 8 insertions, 9 deletions
diff --git a/svx/source/styles/CommonStylePreviewRenderer.cxx b/svx/source/styles/CommonStylePreviewRenderer.cxx
index 65690bed792b..fbd03539fda5 100644
--- a/svx/source/styles/CommonStylePreviewRenderer.cxx
+++ b/svx/source/styles/CommonStylePreviewRenderer.cxx
@@ -62,7 +62,7 @@ bool CommonStylePreviewRenderer::recalculate()
{
m_pFont.reset();
- std::unique_ptr<SfxItemSet> pItemSet(mpStyle->GetItemSetForPreview());
+ std::optional<SfxItemSet> pItemSet(mpStyle->GetItemSetForPreview());
if (!pItemSet) return false;
diff --git a/svx/source/tbxctrls/StylesPreviewWindow.cxx b/svx/source/tbxctrls/StylesPreviewWindow.cxx
index 228fc3f05102..eef8bba791e5 100644
--- a/svx/source/tbxctrls/StylesPreviewWindow.cxx
+++ b/svx/source/tbxctrls/StylesPreviewWindow.cxx
@@ -143,7 +143,7 @@ bool StylesPreviewWindow_Base::Command(const CommandEvent& rEvent)
return false;
}
-static Color GetTextColorFromItemSet(std::unique_ptr<const SfxItemSet> const& pItemSet)
+static Color GetTextColorFromItemSet(std::optional<SfxItemSet> const& pItemSet)
{
const SfxPoolItem* pItem = pItemSet->GetItem(SID_ATTR_CHAR_COLOR);
if (pItem)
@@ -152,7 +152,7 @@ static Color GetTextColorFromItemSet(std::unique_ptr<const SfxItemSet> const& pI
return COL_AUTO;
}
-static Color GetHighlightColorFromItemSet(std::unique_ptr<const SfxItemSet> const& pItemSet)
+static Color GetHighlightColorFromItemSet(std::optional<SfxItemSet> const& pItemSet)
{
const SfxPoolItem* pItem = pItemSet->GetItem(SID_ATTR_BRUSH_CHAR);
if (pItem)
@@ -161,7 +161,7 @@ static Color GetHighlightColorFromItemSet(std::unique_ptr<const SfxItemSet> cons
return COL_AUTO;
}
-static Color GetBackgroundColorFromItemSet(std::unique_ptr<const SfxItemSet> const& pItemSet)
+static Color GetBackgroundColorFromItemSet(std::optional<SfxItemSet> const& pItemSet)
{
const SfxPoolItem* pItem = pItemSet->GetItem(XATTR_FILLCOLOR);
if (pItem)
@@ -170,8 +170,7 @@ static Color GetBackgroundColorFromItemSet(std::unique_ptr<const SfxItemSet> con
return COL_AUTO;
}
-static css::drawing::FillStyle
-GetFillStyleFromItemSet(std::unique_ptr<const SfxItemSet> const& pItemSet)
+static css::drawing::FillStyle GetFillStyleFromItemSet(std::optional<SfxItemSet> const& pItemSet)
{
const SfxPoolItem* pItem = pItemSet->GetItem(XATTR_FILLSTYLE);
if (pItem)
@@ -181,7 +180,7 @@ GetFillStyleFromItemSet(std::unique_ptr<const SfxItemSet> const& pItemSet)
}
static SvxFont GetFontFromItems(const SvxFontItem* pFontItem, Size aPixelFontSize,
- std::unique_ptr<const SfxItemSet> const& pItemSet)
+ std::optional<SfxItemSet> const& pItemSet)
{
SvxFont aFont;
@@ -261,7 +260,7 @@ void StyleItemController::DrawEntry(vcl::RenderContext& rRenderContext)
DrawContentBackground(rRenderContext, aContentRect, aOriginalColor);
- std::unique_ptr<const SfxItemSet> const pItemSet(pStyle->GetItemSetForPreview());
+ std::optional<SfxItemSet> const pItemSet(pStyle->GetItemSetForPreview());
if (!pItemSet)
return;
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 4521be0db733..1add34406833 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1168,7 +1168,7 @@ void SvxStyleBox_Base::SetupEntry(vcl::RenderContext& rRenderContext, sal_Int32
if (!pStyle )
return;
- std::unique_ptr<const SfxItemSet> const pItemSet(pStyle->GetItemSetForPreview());
+ std::optional<SfxItemSet> const pItemSet(pStyle->GetItemSetForPreview());
if (!pItemSet) return;
const SvxFontItem * const pFontItem =