summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cui/source/tabpages/numpages.cxx2
-rw-r--r--editeng/source/items/numitem.cxx11
-rw-r--r--editeng/source/outliner/outliner.cxx2
-rw-r--r--editeng/source/rtf/svxrtf.cxx2
-rw-r--r--filter/source/svg/svgwriter.hxx4
-rw-r--r--include/editeng/numitem.hxx6
-rw-r--r--include/editeng/svxrtf.hxx4
-rw-r--r--include/vcl/outdevstate.hxx4
-rw-r--r--sd/source/ui/dlg/BulletAndPositionDlg.cxx2
-rw-r--r--svx/source/sidebar/nbdtmg.cxx2
-rw-r--r--sw/source/core/doc/number.cxx4
-rw-r--r--sw/source/core/text/txtfld.cxx2
-rw-r--r--sw/source/core/unocore/unosett.cxx2
-rw-r--r--sw/source/filter/writer/writer.cxx7
-rw-r--r--sw/source/filter/ww8/wrtw8num.cxx4
-rw-r--r--vcl/inc/window.h2
-rw-r--r--vcl/source/outdev/outdevstate.cxx2
-rw-r--r--vcl/source/window/window2.cxx2
-rw-r--r--vcl/unx/gtk3/gtkinst.cxx16
19 files changed, 41 insertions, 39 deletions
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();