accessibility/source/extended/accessibletabbar.cxx | 3 -- accessibility/source/standard/accessiblemenucomponent.cxx | 4 +-- basctl/source/accessibility/accessibledialogcontrolshape.cxx | 3 -- basctl/source/accessibility/accessibledialogwindow.cxx | 3 -- include/toolkit/awt/vclxfont.hxx | 11 ++------ toolkit/source/awt/vclxaccessiblecomponent.cxx | 3 -- toolkit/source/awt/vclxdevice.cxx | 4 +-- toolkit/source/awt/vclxfont.cxx | 14 ++--------- 8 files changed, 14 insertions(+), 31 deletions(-)
New commits: commit 33e0bd1572c9aef6080e80a645121f4dae5e5eb5 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Dec 4 13:11:19 2024 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Dec 6 10:53:53 2024 +0100 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.wegh...@posteo.de> (cherry picked from commit 7431507d247b6a5e867ae85647550f55d3641e31) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177932 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() ) commit 57f9321724eb2d1317270aa78b7bba280fc4e9a5 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Dec 4 12:24:46 2024 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Dec 6 10:53:47 2024 +0100 Use '#pragma once' in vclxfont.hxx Change-Id: I445ec8a08c6622c681e459efc2dd2afbf74dd78e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177794 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins (cherry picked from commit 78ef285661c9f936c2bf2fa832c3aec7bbb1760a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177931 diff --git a/include/toolkit/awt/vclxfont.hxx b/include/toolkit/awt/vclxfont.hxx index c3276de03c9f..16f349038287 100644 --- a/include/toolkit/awt/vclxfont.hxx +++ b/include/toolkit/awt/vclxfont.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_TOOLKIT_AWT_VCLXFONT_HXX -#define INCLUDED_TOOLKIT_AWT_VCLXFONT_HXX +#pragma once #include <config_options.h> #include <memory> @@ -67,7 +66,4 @@ public: sal_Bool SAL_CALL hasGlyphs( const OUString& aText ) override; }; - -#endif // INCLUDED_TOOLKIT_AWT_VCLXFONT_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */