From 1944e3ddc0b2247de3138d2a441cd6999e21fd9a Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Thu, 5 Oct 2017 06:19:56 +0300 Subject: Rename and move SAL_U/W to o3tl::toU/W Previosly (since commit 9ac98e6e3488e434bf4864ecfb13a121784f640b) it was expected to gradually remove SAL_U/W usage in Windows code by replacing with reinterpret_cast or changing to some bettertypes. But as it's useful to make use of fact that LibreOffice and Windows use compatible representation of strings, this commit puts these functions to a better-suited o3tl, and recommends that the functions be consistently used throughout Windows-specific code to reflect the compatibility and keep the casts safe. Change-Id: I2f7c65606d0e2d0c01a00f08812bb4ab7659c5f6 Reviewed-on: https://gerrit.libreoffice.org/43150 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- canvas/source/directx/dx_canvasfont.cxx | 8 ++------ canvas/source/directx/dx_canvashelper.cxx | 3 ++- 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'canvas') diff --git a/canvas/source/directx/dx_canvasfont.cxx b/canvas/source/directx/dx_canvasfont.cxx index 0fa32688ea6f..5bf74ccc0d2e 100644 --- a/canvas/source/directx/dx_canvasfont.cxx +++ b/canvas/source/directx/dx_canvasfont.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include @@ -56,12 +57,7 @@ namespace dxcanvas maFontRequest( rFontRequest ), maFontMatrix( fontMatrix ) { - const sal_Int32 nLen(rFontRequest.FontDescription.FamilyName.getLength()); - const sal_Unicode* pStr(rFontRequest.FontDescription.FamilyName.getStr()); - std::vector< sal_Unicode > pStrBuf(nLen+1,0); - std::copy(pStr,pStr+nLen,&pStrBuf[0]); - - mpFontFamily.reset( new Gdiplus::FontFamily(SAL_W(&pStrBuf[0]),nullptr) ); + mpFontFamily.reset( new Gdiplus::FontFamily(o3tl::toW(rFontRequest.FontDescription.FamilyName.getStr()),nullptr) ); if( !mpFontFamily->IsAvailable() ) mpFontFamily.reset( new Gdiplus::FontFamily(L"Arial",nullptr) ); diff --git a/canvas/source/directx/dx_canvashelper.cxx b/canvas/source/directx/dx_canvashelper.cxx index 87b9066fc08f..86222437d090 100644 --- a/canvas/source/directx/dx_canvashelper.cxx +++ b/canvas/source/directx/dx_canvashelper.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -521,7 +522,7 @@ namespace dxcanvas // TODO(F2): Proper layout (BiDi, CTL)! IMHO must use // DrawDriverString here, and perform layouting myself... ENSURE_OR_THROW( - Gdiplus::Ok == pGraphics->DrawString( SAL_W(text.Text.copy( text.StartPosition, + Gdiplus::Ok == pGraphics->DrawString( o3tl::toW(text.Text.copy( text.StartPosition, text.Length ).getStr()), text.Length, pFont->getFont().get(), -- cgit