summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-12-04 13:11:19 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2024-12-06 10:53:53 +0100
commit33e0bd1572c9aef6080e80a645121f4dae5e5eb5 (patch)
treed672ab5cbf75e436f1905346a8b43018beb8c258
parent57f9321724eb2d1317270aa78b7bba280fc4e9a5 (diff)
toolkit: Pass VCLXFont init args in ctor
Pass arguments right away in ctor rather than having a ctor that takes no arguments and then having to call VCLXFont::Init with the arguments right after calling the ctor. Change-Id: I651e27154499f61638409377438f9589bc7412a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177795 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> (cherry picked from commit 7431507d247b6a5e867ae85647550f55d3641e31) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177932
-rw-r--r--accessibility/source/extended/accessibletabbar.cxx3
-rw-r--r--accessibility/source/standard/accessiblemenucomponent.cxx4
-rw-r--r--basctl/source/accessibility/accessibledialogcontrolshape.cxx3
-rw-r--r--basctl/source/accessibility/accessibledialogwindow.cxx3
-rw-r--r--include/toolkit/awt/vclxfont.hxx5
-rw-r--r--toolkit/source/awt/vclxaccessiblecomponent.cxx3
-rw-r--r--toolkit/source/awt/vclxdevice.cxx4
-rw-r--r--toolkit/source/awt/vclxfont.cxx14
8 files changed, 13 insertions, 26 deletions
diff --git a/accessibility/source/extended/accessibletabbar.cxx b/accessibility/source/extended/accessibletabbar.cxx
index 2b1522f30a28..f6b722c09d88 100644
--- a/accessibility/source/extended/accessibletabbar.cxx
+++ b/accessibility/source/extended/accessibletabbar.cxx
@@ -443,8 +443,7 @@ namespace accessibility
aFont = m_pTabBar->GetControlFont();
else
aFont = m_pTabBar->GetFont();
- rtl::Reference<VCLXFont> pVCLXFont = new VCLXFont;
- pVCLXFont->Init( *xDev, aFont );
+ rtl::Reference<VCLXFont> pVCLXFont = new VCLXFont(*xDev, aFont);
xFont = pVCLXFont;
}
}
diff --git a/accessibility/source/standard/accessiblemenucomponent.cxx b/accessibility/source/standard/accessiblemenucomponent.cxx
index 051828d21a1f..470a87fc8234 100644
--- a/accessibility/source/standard/accessiblemenucomponent.cxx
+++ b/accessibility/source/standard/accessiblemenucomponent.cxx
@@ -293,8 +293,8 @@ Reference< awt::XFont > OAccessibleMenuComponent::getFont( )
if ( xDev.is() )
{
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
- rtl::Reference<VCLXFont> pVCLXFont = new VCLXFont;
- pVCLXFont->Init( *xDev, rStyleSettings.GetMenuFont() );
+ rtl::Reference<VCLXFont> pVCLXFont
+ = new VCLXFont(*xDev, rStyleSettings.GetMenuFont());
xFont = pVCLXFont;
}
}
diff --git a/basctl/source/accessibility/accessibledialogcontrolshape.cxx b/basctl/source/accessibility/accessibledialogcontrolshape.cxx
index 22e9403bfed2..0dbe0bbbf364 100644
--- a/basctl/source/accessibility/accessibledialogcontrolshape.cxx
+++ b/basctl/source/accessibility/accessibledialogcontrolshape.cxx
@@ -497,8 +497,7 @@ Reference< awt::XFont > AccessibleDialogControlShape::getFont( )
aFont = pWindow->GetControlFont();
else
aFont = pWindow->GetFont();
- rtl::Reference<VCLXFont> pVCLXFont = new VCLXFont;
- pVCLXFont->Init( *xDev, aFont );
+ rtl::Reference<VCLXFont> pVCLXFont = new VCLXFont(*xDev, aFont);
xFont = pVCLXFont;
}
}
diff --git a/basctl/source/accessibility/accessibledialogwindow.cxx b/basctl/source/accessibility/accessibledialogwindow.cxx
index 39b19e8a4462..48e887e34dd2 100644
--- a/basctl/source/accessibility/accessibledialogwindow.cxx
+++ b/basctl/source/accessibility/accessibledialogwindow.cxx
@@ -766,8 +766,7 @@ Reference< awt::XFont > AccessibleDialogWindow::getFont( )
aFont = m_pDialogWindow->GetControlFont();
else
aFont = m_pDialogWindow->GetFont();
- rtl::Reference<VCLXFont> pVCLXFont = new VCLXFont;
- pVCLXFont->Init( *xDev, aFont );
+ rtl::Reference<VCLXFont> pVCLXFont = new VCLXFont(*xDev, aFont);
xFont = pVCLXFont;
}
}
diff --git a/include/toolkit/awt/vclxfont.hxx b/include/toolkit/awt/vclxfont.hxx
index 16f349038287..4452659e8e4e 100644
--- a/include/toolkit/awt/vclxfont.hxx
+++ b/include/toolkit/awt/vclxfont.hxx
@@ -47,10 +47,9 @@ class UNLESS_MERGELIBS_MORE(TOOLKIT_DLLPUBLIC) VCLXFont final :
bool ImplAssertValidFontMetric();
public:
- VCLXFont();
- virtual ~VCLXFont() override;
+ VCLXFont(css::awt::XDevice& rxDev, const vcl::Font& rFont);
+ virtual ~VCLXFont() override;
- void Init( css::awt::XDevice& rxDev, const vcl::Font& rFont );
const vcl::Font& GetFont() const { return maFont; }
// css::lang::XFont
diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx
index b53e56bf5921..e415f353c848 100644
--- a/toolkit/source/awt/vclxaccessiblecomponent.cxx
+++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx
@@ -820,8 +820,7 @@ uno::Reference< awt::XFont > SAL_CALL VCLXAccessibleComponent::getFont( )
aFont = pWindow->GetControlFont();
else
aFont = pWindow->GetFont();
- rtl::Reference<VCLXFont> pVCLXFont = new VCLXFont;
- pVCLXFont->Init( *xDev, aFont );
+ rtl::Reference<VCLXFont> pVCLXFont = new VCLXFont(*xDev, aFont);
xFont = pVCLXFont;
}
}
diff --git a/toolkit/source/awt/vclxdevice.cxx b/toolkit/source/awt/vclxdevice.cxx
index c4ed98146713..13acc4d270ec 100644
--- a/toolkit/source/awt/vclxdevice.cxx
+++ b/toolkit/source/awt/vclxdevice.cxx
@@ -112,8 +112,8 @@ css::uno::Reference< css::awt::XFont > VCLXDevice::getFont( const css::awt::Font
css::uno::Reference< css::awt::XFont > xRef;
if( mpOutputDevice )
{
- rtl::Reference<VCLXFont> pMetric = new VCLXFont;
- pMetric->Init( *this, VCLUnoHelper::CreateFont( rDescriptor, mpOutputDevice->GetFont() ) );
+ rtl::Reference<VCLXFont> pMetric
+ = new VCLXFont(*this, VCLUnoHelper::CreateFont(rDescriptor, mpOutputDevice->GetFont()));
xRef = pMetric;
}
return xRef;
diff --git a/toolkit/source/awt/vclxfont.cxx b/toolkit/source/awt/vclxfont.cxx
index 32a42dec7579..d95ec480191b 100644
--- a/toolkit/source/awt/vclxfont.cxx
+++ b/toolkit/source/awt/vclxfont.cxx
@@ -30,24 +30,16 @@
#include <vcl/outdev.hxx>
#include <vcl/svapp.hxx>
-VCLXFont::VCLXFont()
+VCLXFont::VCLXFont(css::awt::XDevice& rxDev, const vcl::Font& rFont)
{
- mpFontMetric = nullptr;
+ mxDevice = &rxDev;
+ maFont = rFont;
}
VCLXFont::~VCLXFont()
{
}
-void VCLXFont::Init( css::awt::XDevice& rxDev, const vcl::Font& rFont )
-{
- mxDevice = &rxDev;
-
- mpFontMetric.reset();
-
- maFont = rFont;
-}
-
bool VCLXFont::ImplAssertValidFontMetric()
{
if ( !mpFontMetric && mxDevice.is() )