[Libreoffice-commits] core.git: 2 commits - cui/source drawinglayer/source editeng/source filter/source include/drawinglayer include/editeng include/svx include/vcl sd/source svx/source sw/source vcl/inc vcl/source vcl/unx
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Sun Aug 22 14:23:53 UTC 2021
cui/source/tabpages/numpages.cxx | 2 -
drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx | 2 -
drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx | 2 -
editeng/source/items/numitem.cxx | 11 +++++---
editeng/source/outliner/outliner.cxx | 2 -
editeng/source/rtf/svxrtf.cxx | 2 -
filter/source/svg/svgwriter.hxx | 4 +--
include/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx | 4 ++-
include/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx | 4 ++-
include/editeng/numitem.hxx | 6 ++--
include/editeng/svxrtf.hxx | 4 +--
include/svx/e3dsceneupdater.hxx | 9 ++-----
include/vcl/outdevstate.hxx | 4 +--
sd/source/ui/dlg/BulletAndPositionDlg.cxx | 2 -
svx/source/engine3d/e3dsceneupdater.cxx | 7 +----
svx/source/sidebar/nbdtmg.cxx | 2 -
sw/source/core/doc/number.cxx | 4 +--
sw/source/core/text/txtfld.cxx | 2 -
sw/source/core/unocore/unosett.cxx | 2 -
sw/source/filter/writer/writer.cxx | 7 ++---
sw/source/filter/ww8/wrtw8num.cxx | 4 +--
vcl/inc/window.h | 2 -
vcl/source/outdev/outdevstate.cxx | 2 -
vcl/source/window/window2.cxx | 2 -
vcl/unx/gtk3/gtkinst.cxx | 16 ++++++-------
25 files changed, 54 insertions(+), 54 deletions(-)
New commits:
commit 0944ef734571ae34cbecc53812e576a39b3722f0
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sat Aug 21 19:38:58 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Aug 22 16:23:26 2021 +0200
no need to use unique_ptr for ViewInformation3D
it is already a COW type
Change-Id: Ie098bd293115650128ebb18d5c16747b519717c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120825
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx
index b7d1c8abdd9b..04796233693d 100644
--- a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx
@@ -488,7 +488,7 @@ namespace drawinglayer::primitive3d
// new one and clear current decompositiopn
SdrExtrudePrimitive3D* pThat = const_cast< SdrExtrudePrimitive3D* >(this);
pThat->setBuffered3DDecomposition(Primitive3DContainer());
- pThat->mpLastRLGViewInformation.reset( new geometry::ViewInformation3D(rViewInformation) );
+ pThat->mpLastRLGViewInformation = rViewInformation;
}
}
diff --git a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx
index 1d5b918a27bf..291c82af1d2e 100644
--- a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx
@@ -346,7 +346,7 @@ namespace drawinglayer::primitive3d
// new one and clear current decompositiopn
SdrLathePrimitive3D* pThat = const_cast< SdrLathePrimitive3D* >(this);
pThat->setBuffered3DDecomposition(Primitive3DContainer());
- pThat->mpLastRLGViewInformation.reset( new geometry::ViewInformation3D(rViewInformation) );
+ pThat->mpLastRLGViewInformation = rViewInformation;
}
}
diff --git a/include/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx b/include/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx
index 76078be50fde..d20d4b48a1d0 100644
--- a/include/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx
+++ b/include/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx
@@ -22,9 +22,11 @@
#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
#include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <memory>
+#include <optional>
namespace drawinglayer::primitive3d
@@ -54,7 +56,7 @@ namespace drawinglayer::primitive3d
double mfBackScale;
/// decomposition data when ReducedLineGeometry is used, see get3DDecomposition
- std::unique_ptr<geometry::ViewInformation3D> mpLastRLGViewInformation;
+ std::optional<geometry::ViewInformation3D> mpLastRLGViewInformation;
bool mbSmoothNormals : 1; // Plane self
bool mbSmoothLids : 1; // Front/back
diff --git a/include/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx b/include/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx
index 1945af6be877..941c949cbb8f 100644
--- a/include/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx
+++ b/include/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx
@@ -22,9 +22,11 @@
#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
#include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <memory>
+#include <optional>
namespace drawinglayer::primitive3d
@@ -56,7 +58,7 @@ namespace drawinglayer::primitive3d
double mfRotation;
/// decomposition data when ReducedLineGeometry is used, see get3DDecomposition
- std::unique_ptr<geometry::ViewInformation3D> mpLastRLGViewInformation;
+ std::optional<geometry::ViewInformation3D> mpLastRLGViewInformation;
bool mbSmoothNormals : 1; // Plane self
bool mbSmoothLids : 1; // Front/back
diff --git a/include/svx/e3dsceneupdater.hxx b/include/svx/e3dsceneupdater.hxx
index 5538eb163076..1baf43249a83 100644
--- a/include/svx/e3dsceneupdater.hxx
+++ b/include/svx/e3dsceneupdater.hxx
@@ -21,16 +21,13 @@
#define INCLUDED_SVX_E3DSCENEUPDATER_HXX
#include <svx/svxdllapi.h>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
#include <memory>
+#include <optional>
class SdrObject;
class E3dScene;
-namespace drawinglayer::geometry
-{
-class ViewInformation3D;
-}
-
/** Helper for 3d object changes affecting 2d geometry
This class is a helper to encapsulate 3D object changes which shall
@@ -55,7 +52,7 @@ class SVXCORE_DLLPUBLIC E3DModifySceneSnapRectUpdater
// the 3d transformation stack at the time of construction, valid when
// mpScene is not zero
- std::unique_ptr<drawinglayer::geometry::ViewInformation3D> mpViewInformation3D;
+ std::optional<drawinglayer::geometry::ViewInformation3D> mpViewInformation3D;
public:
// the constructor evaluates and sets the members at construction time
diff --git a/svx/source/engine3d/e3dsceneupdater.cxx b/svx/source/engine3d/e3dsceneupdater.cxx
index f2569e325b4e..a72b4126d5cc 100644
--- a/svx/source/engine3d/e3dsceneupdater.cxx
+++ b/svx/source/engine3d/e3dsceneupdater.cxx
@@ -49,9 +49,7 @@ E3DModifySceneSnapRectUpdater::E3DModifySceneSnapRectUpdater(const SdrObject* pO
else
{
// secure current 3D transformation stack
- mpViewInformation3D.reset(
- new drawinglayer::geometry::ViewInformation3D(
- rVCScene.getViewInformation3D(aAllContentRange)));
+ mpViewInformation3D = rVCScene.getViewInformation3D(aAllContentRange);
}
}
@@ -75,14 +73,13 @@ E3DModifySceneSnapRectUpdater::~E3DModifySceneSnapRectUpdater()
{
// If Yes, it needs to be updated since it's - for historical reasons -
// part of the basic 3d transformation stack of the scene
- drawinglayer::geometry::ViewInformation3D* pNew = new drawinglayer::geometry::ViewInformation3D(
+ mpViewInformation3D = drawinglayer::geometry::ViewInformation3D(
mpScene->GetTransform(), // replace object transformation with new local transform
mpViewInformation3D->getOrientation(),
mpViewInformation3D->getProjection(),
mpViewInformation3D->getDeviceToView(),
mpViewInformation3D->getViewTime(),
mpViewInformation3D->getExtendedInformationSequence());
- mpViewInformation3D.reset(pNew);
}
// transform content range to scene-relative coordinates using old 3d transformation stack
commit 0f6457b1e867c49bc82f2b18e2e462fb7100051f
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sat Aug 21 17:04:39 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Aug 22 16:23:14 2021 +0200
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 at collabora.co.uk>
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 7c3d2768101e..59093e572c89 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -1930,7 +1930,7 @@ IMPL_LINK_NOARG(SvxNumOptionsTabPage, BulletHdl_Impl, weld::Button&, void)
SvxCharacterMap aMap(GetFrameWeld(), nullptr, nullptr);
sal_uInt16 nMask = 1;
- const vcl::Font* pFmtFont = nullptr;
+ std::optional<vcl::Font> pFmtFont;
bool bSameBullet = true;
sal_UCS4 cBullet = 0;
bool bFirst = true;
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.
diff --git a/filter/source/svg/svgwriter.hxx b/filter/source/svg/svgwriter.hxx
index 30799453c616..7f0526d62fb9 100644
--- a/filter/source/svg/svgwriter.hxx
+++ b/filter/source/svg/svgwriter.hxx
@@ -78,14 +78,14 @@ struct SVGState
struct PartialState
{
PushFlags meFlags;
- ::std::unique_ptr<vcl::Font> mupFont;
+ ::std::optional<vcl::Font> mupFont;
sal_Int32 mnRegionClipPathId;
const vcl::Font& getFont( const vcl::Font& rDefaultFont ) const
{ return mupFont ? *mupFont : rDefaultFont; }
void setFont( const vcl::Font& rFont )
- { mupFont.reset( new vcl::Font(rFont) ); }
+ { mupFont = rFont; }
PartialState()
: meFlags( PushFlags::NONE )
diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx
index 63e819edf27e..5f444e29389d 100644
--- a/include/editeng/numitem.hxx
+++ b/include/editeng/numitem.hxx
@@ -30,12 +30,12 @@
#include <editeng/editengdllapi.h>
#include <o3tl/typed_flags_set.hxx>
#include <vcl/vclenum.hxx>
+#include <vcl/font.hxx>
#include <memory>
#include <optional>
#include <algorithm>
class SvxBrushItem;
-namespace vcl { class Font; }
class Graphic;
class SvxNodeNum;
namespace com::sun::star::text { class XNumberingFormatter; }
@@ -147,7 +147,7 @@ private:
sal_Int16 eVertOrient; // vertical alignment of a bitmap
Size aGraphicSize; // Always! in 1/100 mm
- std::unique_ptr<vcl::Font>
+ std::optional<vcl::Font>
pBulletFont; // Pointer to the bullet font
OUString sCharStyleName; // Character Style
@@ -181,7 +181,7 @@ public:
virtual OUString GetCharFormatName()const;
void SetBulletFont(const vcl::Font* pFont);
- const vcl::Font* GetBulletFont() const {return pBulletFont.get();}
+ const std::optional<vcl::Font>& GetBulletFont() const { return pBulletFont; }
void SetBulletChar(sal_UCS4 cSet){cBullet = cSet;}
sal_UCS4 GetBulletChar()const {return cBullet;}
void SetBulletRelSize(sal_uInt16 nSet) {nBulletRelSize = std::max(nSet,sal_uInt16(SVX_NUM_REL_SIZE_MIN));}
diff --git a/include/editeng/svxrtf.hxx b/include/editeng/svxrtf.hxx
index 78e38eeefa81..ec42c5045d07 100644
--- a/include/editeng/svxrtf.hxx
+++ b/include/editeng/svxrtf.hxx
@@ -24,6 +24,7 @@
#include <svtools/parrtf.hxx>
#include <rtl/ustring.hxx>
#include <tools/color.hxx>
+#include <vcl/font.hxx>
#include <editeng/editengdllapi.h>
@@ -32,7 +33,6 @@
#include <map>
#include <memory>
-namespace vcl { class Font; }
struct SvxRTFStyleType;
class SvxRTFItemStackType;
class SvxRTFItemStackList : public std::vector<std::unique_ptr<SvxRTFItemStackType>> {};
@@ -101,7 +101,7 @@ class EDITENG_DLLPUBLIC SvxRTFParser : public SvRTFParser
std::optional<EditPosition> mxInsertPosition;
SfxItemPool* pAttrPool;
std::optional<Color> mxDefaultColor;
- std::unique_ptr<vcl::Font> pDfltFont;
+ std::optional<vcl::Font> pDfltFont;
std::unique_ptr<SfxItemSet> pRTFDefaults;
int nDfltFont;
diff --git a/include/vcl/outdevstate.hxx b/include/vcl/outdevstate.hxx
index 62a4af7fbd94..36f02e2f2e42 100644
--- a/include/vcl/outdevstate.hxx
+++ b/include/vcl/outdevstate.hxx
@@ -22,6 +22,7 @@
#include <vcl/mapmod.hxx>
#include <vcl/vclenum.hxx>
+#include <vcl/font.hxx>
#include <tools/color.hxx>
#include <tools/gen.hxx>
@@ -31,7 +32,6 @@
#include <optional>
#include <i18nlangtag/lang.h>
-namespace vcl { class Font; }
namespace vcl { class Region; }
// Flags for OutputDevice::Push() and OutDevState
@@ -86,7 +86,7 @@ struct OutDevState
std::unique_ptr<vcl::Region> mpClipRegion;
std::optional<Color> mpLineColor;
std::optional<Color> mpFillColor;
- std::unique_ptr<vcl::Font> mpFont;
+ std::optional<vcl::Font> mpFont;
std::optional<Color> mpTextColor;
std::optional<Color> mpTextFillColor;
std::optional<Color> mpTextLineColor;
diff --git a/sd/source/ui/dlg/BulletAndPositionDlg.cxx b/sd/source/ui/dlg/BulletAndPositionDlg.cxx
index f8ab303c0dca..e8e5d62ef058 100644
--- a/sd/source/ui/dlg/BulletAndPositionDlg.cxx
+++ b/sd/source/ui/dlg/BulletAndPositionDlg.cxx
@@ -922,7 +922,7 @@ IMPL_LINK_NOARG(SvxBulletAndPositionDlg, BulletHdl_Impl, weld::Button&, void)
SvxCharacterMap aMap(p_Window, nullptr, nullptr);
sal_uInt16 nMask = 1;
- const vcl::Font* pFmtFont = nullptr;
+ std::optional<vcl::Font> pFmtFont;
bool bSameBullet = true;
sal_UCS4 cBullet = 0;
bool bFirst = true;
diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx
index f1ee075a3320..a6325389c874 100644
--- a/svx/source/sidebar/nbdtmg.cxx
+++ b/svx/source/sidebar/nbdtmg.cxx
@@ -308,7 +308,7 @@ void BulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uI
SvxNumberFormat aFmt(aNum.GetLevel(nActLv));
sal_UCS4 cChar = aFmt.GetBulletChar();
- const vcl::Font* pFont = aFmt.GetBulletFont();
+ std::optional<vcl::Font> pFont = aFmt.GetBulletFont();
if ( nIndex >= DEFAULT_BULLET_TYPES )
return;
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index 3d7544e8cd09..e1fe300dda37 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -1182,7 +1182,7 @@ namespace numfunc
sal_Unicode mnLevelChars[MAXLEVEL];
// default bullet list font instance
- std::unique_ptr<vcl::Font> mpFont;
+ std::optional<vcl::Font> mpFont;
};
}
@@ -1308,7 +1308,7 @@ namespace numfunc
void SwDefBulletConfig::InitFont()
{
- mpFont.reset( new vcl::Font( msFontname, OUString(), Size( 0, 14 ) ) );
+ mpFont.emplace( msFontname, OUString(), Size( 0, 14 ) );
mpFont->SetWeight( meFontWeight );
mpFont->SetItalic( meFontItalic );
mpFont->SetCharSet( RTL_TEXTENCODING_SYMBOL );
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index fe292e368cb5..bfcb5ef57c05 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -656,7 +656,7 @@ SwNumberPortion *SwTextFormatter::NewNumberPortion( SwTextFormatInfo &rInf ) con
if( SVX_NUM_CHAR_SPECIAL == rNumFormat.GetNumberingType() )
{
- const vcl::Font *pFormatFnt = rNumFormat.GetBulletFont();
+ const std::optional<vcl::Font> pFormatFnt = rNumFormat.GetBulletFont();
// Build a new bullet font basing on the current paragraph font:
std::unique_ptr<SwFont> pNumFnt(new SwFont( &rInf.GetCharAttr(), pIDSA ));
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
index 76b7839415b0..afc309008ca2 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -1413,7 +1413,7 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetPropertiesForNumFormat
nINT16 = cBullet;
aPropertyValues.push_back(comphelper::makePropertyValue("BulletId", nINT16));
- const vcl::Font* pFont = rFormat.GetBulletFont();
+ std::optional<vcl::Font> pFont = rFormat.GetBulletFont();
//BulletChar
aUString = OUString(&cBullet, 1);
diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx
index f775293554d9..e3ba8cddc9f3 100644
--- a/sw/source/filter/writer/writer.cxx
+++ b/sw/source/filter/writer/writer.cxx
@@ -350,7 +350,6 @@ void Writer::PutNumFormatFontsInAttrPool()
SfxItemPool& rPool = m_pDoc->GetAttrPool();
const SwNumRuleTable& rListTable = m_pDoc->GetNumRuleTable();
const SwNumFormat* pFormat;
- const vcl::Font* pFont;
const vcl::Font* pDefFont = &numfunc::GetDefBulletFont();
bool bCheck = false;
@@ -364,9 +363,9 @@ void Writer::PutNumFormatFontsInAttrPool()
if( SVX_NUM_CHAR_SPECIAL == (pFormat = &pRule->Get( nLvl ))->GetNumberingType() ||
SVX_NUM_BITMAP == pFormat->GetNumberingType() )
{
- pFont = pFormat->GetBulletFont();
- if( nullptr == pFont )
- pFont = pDefFont;
+ std::optional<vcl::Font> pFont = pFormat->GetBulletFont();
+ if( !pFont )
+ pFont = *pDefFont;
if( bCheck )
{
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx
index a5a97854aa4f..aac2b0595f63 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -467,7 +467,7 @@ void MSWordExportBase::NumberingLevel(
OUString sNumStr;
OUString sFontName;
bool bWriteBullet = false;
- const vcl::Font* pBulletFont=nullptr;
+ std::optional<vcl::Font> pBulletFont;
rtl_TextEncoding eChrSet=0;
FontFamily eFamily=FAMILY_DECORATIVE;
if (SVX_NUM_CHAR_SPECIAL == rFormat.GetNumberingType() ||
@@ -519,7 +519,7 @@ void MSWordExportBase::NumberingLevel(
pBulletFont = rFormat.GetBulletFont();
if (!pBulletFont)
{
- pBulletFont = &numfunc::GetDefBulletFont();
+ pBulletFont = numfunc::GetDefBulletFont();
}
eChrSet = pBulletFont->GetCharSet();
diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index cce17f47fb60..2e4ebe07f676 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -252,7 +252,7 @@ public:
PointerStyle maPointer;
Fraction maZoom;
OUString maText;
- std::unique_ptr<vcl::Font>
+ std::optional<vcl::Font>
mpControlFont;
Color maControlForeground;
Color maControlBackground;
diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx
index 51b2c0c874ad..3a4d5e1d420d 100644
--- a/vcl/source/outdev/outdevstate.cxx
+++ b/vcl/source/outdev/outdevstate.cxx
@@ -76,7 +76,7 @@ void OutputDevice::Push( PushFlags nFlags )
rState.mpFillColor = maFillColor;
}
if ( nFlags & PushFlags::FONT )
- rState.mpFont.reset( new vcl::Font( maFont ) );
+ rState.mpFont = maFont;
if ( nFlags & PushFlags::TEXTCOLOR )
rState.mpTextColor = GetTextColor();
if (nFlags & PushFlags::TEXTFILLCOLOR && IsTextFillColor())
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index bd1b6a2f7102..1db7b7aaf280 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -424,7 +424,7 @@ void Window::SetControlFont(const vcl::Font& rFont)
*mpWindowImpl->mpControlFont = rFont;
}
else
- mpWindowImpl->mpControlFont.reset( new vcl::Font(rFont) );
+ mpWindowImpl->mpControlFont = rFont;
CompatStateChanged(StateChangedType::ControlFont);
}
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 8b7780c92cbb..fc56dfaecda0 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -8970,7 +8970,7 @@ class GtkInstanceButton : public GtkInstanceWidget, public virtual weld::Button
private:
GtkButton* m_pButton;
gulong m_nSignalId;
- std::unique_ptr<vcl::Font> m_xFont;
+ std::optional<vcl::Font> m_xFont;
WidgetBackground m_aCustomBackground;
static void signalClicked(GtkButton*, gpointer widget)
@@ -9029,7 +9029,7 @@ public:
virtual void set_font(const vcl::Font& rFont) override
{
- m_xFont.reset(new vcl::Font(rFont));
+ m_xFont = rFont;
GtkWidget* pChild = ::get_label_widget(GTK_WIDGET(m_pButton));
::set_font(GTK_LABEL(pChild), rFont);
}
@@ -9497,7 +9497,7 @@ private:
GtkWidget* m_pPopover;
#if GTK_CHECK_VERSION(4, 0, 0)
gulong m_nToggledSignalId;
- std::unique_ptr<vcl::Font> m_xFont;
+ std::optional<vcl::Font> m_xFont;
WidgetBackground m_aCustomBackground;
#endif
@@ -12059,7 +12059,7 @@ protected:
GtkEditable* m_pEditable;
GtkWidget* m_pDelegate;
private:
- std::unique_ptr<vcl::Font> m_xFont;
+ std::optional<vcl::Font> m_xFont;
gulong m_nChangedSignalId;
gulong m_nInsertTextSignalId;
gulong m_nCursorPosSignalId;
@@ -12308,7 +12308,7 @@ public:
virtual void set_font(const vcl::Font& rFont) override
{
- m_xFont.reset(new vcl::Font(rFont));
+ m_xFont = rFont;
PangoAttrList* pOrigList = get_attributes();
PangoAttrList* pAttrList = pOrigList ? pango_attr_list_copy(pOrigList) : pango_attr_list_new();
update_attr_list(pAttrList, rFont);
@@ -17419,7 +17419,7 @@ private:
GtkEventController* m_pMenuKeyController;
GtkEventController* m_pEntryFocusController;
// std::unique_ptr<CustomRenderMenuButtonHelper> m_xCustomMenuButtonHelper;
- std::unique_ptr<vcl::Font> m_xFont;
+ std::optional<vcl::Font> m_xFont;
std::unique_ptr<comphelper::string::NaturalStringSorter> m_xSorter;
vcl::QuickSelectionEngine m_aQuickSelectionEngine;
std::vector<std::unique_ptr<GtkTreeRowReference, GtkTreeRowReferenceDeleter>> m_aSeparatorRows;
@@ -19162,7 +19162,7 @@ private:
GtkWidget* m_pEntry;
GtkCellView* m_pCellView;
std::unique_ptr<CustomRenderMenuButtonHelper> m_xCustomMenuButtonHelper;
- std::unique_ptr<vcl::Font> m_xFont;
+ std::optional<vcl::Font> m_xFont;
std::unique_ptr<comphelper::string::NaturalStringSorter> m_xSorter;
vcl::QuickSelectionEngine m_aQuickSelectionEngine;
std::vector<std::unique_ptr<GtkTreeRowReference, GtkTreeRowReferenceDeleter>> m_aSeparatorRows;
@@ -20617,7 +20617,7 @@ public:
virtual void set_entry_font(const vcl::Font& rFont) override
{
- m_xFont.reset(new vcl::Font(rFont));
+ m_xFont = rFont;
assert(m_pEntry);
PangoAttrList* pOrigList = gtk_entry_get_attributes(GTK_ENTRY(m_pEntry));
PangoAttrList* pAttrList = pOrigList ? pango_attr_list_copy(pOrigList) : pango_attr_list_new();
More information about the Libreoffice-commits
mailing list