summaryrefslogtreecommitdiff
path: root/sw/source/core/layout/paintfrm.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-11-22 13:11:47 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-11-22 13:34:17 +0100
commit0d653000a6c07327d6db1f95be3d21d50d505423 (patch)
tree31c38f67117af9f72664dbba170eb822fc4e1193 /sw/source/core/layout/paintfrm.cxx
parent7f91d6cceeeafb588f545be4c383e312d9e42bf7 (diff)
improve function-local statics in sw
Change-Id: I36b0e9b2819a442f01182f551dbc2bf7d5c878f4 Reviewed-on: https://gerrit.libreoffice.org/63788 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/core/layout/paintfrm.cxx')
-rw-r--r--sw/source/core/layout/paintfrm.cxx28
1 files changed, 14 insertions, 14 deletions
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index dfa37544339e..04bce461ed05 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -6965,20 +6965,20 @@ const Color SwPageFrame::GetDrawBackgrdColor() const
/// create/return font used to paint the "empty page" string
const vcl::Font& SwPageFrame::GetEmptyPageFont()
{
- static vcl::Font* pEmptyPgFont = nullptr;
- if ( nullptr == pEmptyPgFont )
- {
- pEmptyPgFont = new vcl::Font;
- pEmptyPgFont->SetFontSize( Size( 0, 80 * 20 )); // == 80 pt
- pEmptyPgFont->SetWeight( WEIGHT_BOLD );
- pEmptyPgFont->SetStyleName( aEmptyOUStr );
- pEmptyPgFont->SetFamilyName("Helvetica");
- pEmptyPgFont->SetFamily( FAMILY_SWISS );
- pEmptyPgFont->SetTransparent( true );
- pEmptyPgFont->SetColor( COL_GRAY );
- }
-
- return *pEmptyPgFont;
+ static vcl::Font aEmptyPgFont = [&]()
+ {
+ vcl::Font tmp;
+ tmp.SetFontSize( Size( 0, 80 * 20 )); // == 80 pt
+ tmp.SetWeight( WEIGHT_BOLD );
+ tmp.SetStyleName( aEmptyOUStr );
+ tmp.SetFamilyName("Helvetica");
+ tmp.SetFamily( FAMILY_SWISS );
+ tmp.SetTransparent( true );
+ tmp.SetColor( COL_GRAY );
+ return tmp;
+ }();
+
+ return aEmptyPgFont;
}
/**