summaryrefslogtreecommitdiff
path: root/editeng/source
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-08-21 17:04:39 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-08-22 16:23:14 +0200
commit0f6457b1e867c49bc82f2b18e2e462fb7100051f (patch)
tree500430f8d8bbfd7fa1a2d49430aa8c7c443ce337 /editeng/source
parentf30c3ff66a24d5031c077be0cb839f5f249c188e (diff)
don't store vcl::Font with unique_ptr
it is already a COW object, so just use std::optional Change-Id: I5ced54dbf3dc222316d9bcf3581b36e0f6e6e270 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120818 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng/source')
-rw-r--r--editeng/source/items/numitem.cxx11
-rw-r--r--editeng/source/outliner/outliner.cxx2
-rw-r--r--editeng/source/rtf/svxrtf.cxx2
3 files changed, 9 insertions, 6 deletions
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index 933735db2ae9..7348eb16df4d 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -233,10 +233,10 @@ SvxNumberFormat::SvxNumberFormat( SvStream &rStream )
rStream.ReadUInt16( hasBulletFont );
if ( hasBulletFont )
{
- pBulletFont.reset( new vcl::Font() );
+ pBulletFont.emplace();
ReadFont( rStream, *pBulletFont );
}
- else pBulletFont = nullptr;
+ else pBulletFont.reset();
tools::GenericTypeSerializer aSerializer(rStream);
aSerializer.readSize(aGraphicSize);
@@ -364,7 +364,7 @@ SvxNumberFormat& SvxNumberFormat::operator=( const SvxNumberFormat& rFormat )
}
pBulletFont.reset();
if(rFormat.pBulletFont)
- pBulletFont.reset( new vcl::Font(*rFormat.pBulletFont) );
+ pBulletFont = *rFormat.pBulletFont;
return *this;
}
@@ -454,7 +454,10 @@ sal_Int16 SvxNumberFormat::GetVertOrient() const
void SvxNumberFormat::SetBulletFont(const vcl::Font* pFont)
{
- pBulletFont.reset( pFont ? new vcl::Font(*pFont): nullptr );
+ if (pFont)
+ pBulletFont = *pFont;
+ else
+ pBulletFont.reset();
}
void SvxNumberFormat::SetPositionAndSpaceMode( SvxNumPositionAndSpaceMode ePositionAndSpaceMode )
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 0459ac1f2873..73de85fff3e4 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -829,7 +829,7 @@ vcl::Font Outliner::ImpCalcBulletFont( sal_Int32 nPara ) const
}
vcl::Font aBulletFont;
- const vcl::Font *pSourceFont = nullptr;
+ std::optional<vcl::Font> pSourceFont;
if ( pFmt->GetNumberingType() == SVX_NUM_CHAR_SPECIAL )
{
pSourceFont = pFmt->GetBulletFont();
diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index 4157ca894aa5..1d1c0993a5d1 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -70,7 +70,7 @@ SvxRTFParser::SvxRTFParser( SfxItemPool& rPool, SvStream& rIn )
, bIsLeftToRightDef( true)
, bIsInReadStyleTab( false)
{
- pDfltFont.reset( new vcl::Font );
+ pDfltFont.emplace();
mxDefaultColor = Color();
// generate the correct WhichId table from the set WhichIds.