summaryrefslogtreecommitdiff
path: root/vcl/win
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2017-10-05 06:19:56 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2017-10-05 16:02:52 +0200
commit1944e3ddc0b2247de3138d2a441cd6999e21fd9a (patch)
treeb59f213e245e151ee792ca424fd06b5a11c88857 /vcl/win
parent81d404803f477eb71b74eb9c7a67bba6b1af95d1 (diff)
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 <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl/win')
-rw-r--r--vcl/win/app/salinfo.cxx12
-rw-r--r--vcl/win/app/salinst.cxx7
-rw-r--r--vcl/win/gdi/salfont.cxx29
-rw-r--r--vcl/win/gdi/salnativewidgets-luna.cxx3
-rw-r--r--vcl/win/gdi/salprn.cxx41
-rw-r--r--vcl/win/window/salframe.cxx19
-rw-r--r--vcl/win/window/salmenu.cxx7
7 files changed, 62 insertions, 56 deletions
diff --git a/vcl/win/app/salinfo.cxx b/vcl/win/app/salinfo.cxx
index c96f80862b53..52398b3b13f1 100644
--- a/vcl/win/app/salinfo.cxx
+++ b/vcl/win/app/salinfo.cxx
@@ -19,7 +19,7 @@
#include "svsys.h"
#include "rtl/ustrbuf.hxx"
-
+#include <o3tl/char16_t2wchar_t.hxx>
#include <vcl/window.hxx>
@@ -59,7 +59,7 @@ bool WinSalSystem::handleMonitorCallback( sal_IntPtr hMonitor, sal_IntPtr, sal_I
if( GetMonitorInfoW( reinterpret_cast<HMONITOR>(hMonitor), &aInfo ) )
{
aInfo.szDevice[CCHDEVICENAME-1] = 0;
- OUString aDeviceName( SAL_U(aInfo.szDevice) );
+ OUString aDeviceName( o3tl::toU(aInfo.szDevice) );
std::map< OUString, unsigned int >::const_iterator it =
m_aDeviceNameToMonitor.find( aDeviceName );
if( it != m_aDeviceNameToMonitor.end() )
@@ -110,8 +110,8 @@ bool WinSalSystem::initMonitors()
{
aDev.DeviceName[31] = 0;
aDev.DeviceString[127] = 0;
- OUString aDeviceName( SAL_U(aDev.DeviceName) );
- OUString aDeviceString( SAL_U(aDev.DeviceString) );
+ OUString aDeviceName( o3tl::toU(aDev.DeviceName) );
+ OUString aDeviceString( o3tl::toU(aDev.DeviceString) );
if( aDeviceStringCount.find( aDeviceString ) == aDeviceStringCount.end() )
aDeviceStringCount[ aDeviceString ] = 1;
else
@@ -169,8 +169,8 @@ int WinSalSystem::ShowNativeMessageBox(const OUString& rTitle, const OUString& r
ImplHideSplash();
return MessageBoxW(
nullptr,
- SAL_W(rMessage.getStr()),
- SAL_W(rTitle.getStr()),
+ o3tl::toW(rMessage.getStr()),
+ o3tl::toW(rTitle.getStr()),
MB_TASKMODAL | MB_SETFOREGROUND | MB_ICONWARNING | MB_DEFBUTTON1);
}
diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 3cfa96a5b0b4..a0a323b2d037 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -25,6 +25,7 @@
#include <osl/file.hxx>
#include <tools/time.hxx>
#include <comphelper/solarmutex.hxx>
+#include <o3tl/char16_t2wchar_t.hxx>
#include <vcl/inputtypes.hxx>
#include <vcl/opengl/OpenGLHelper.hxx>
@@ -88,7 +89,7 @@ void SalAbort( const OUString& rErrorText, bool )
CrashReporter::AddKeyValue("AbortMessage", rErrorText);
// make sure crash reporter is triggered
RaiseException( 0, EXCEPTION_NONCONTINUABLE, 0, nullptr );
- FatalAppExitW( 0, SAL_W(rErrorText.getStr()) );
+ FatalAppExitW( 0, o3tl::toW(rErrorText.getStr()) );
}
}
@@ -834,7 +835,7 @@ void WinSalInstance::AddToRecentDocumentList(const OUString& rFileUrl, const OUS
{
IShellItem* pShellItem = nullptr;
- HRESULT hr = SHCreateItemFromParsingName(SAL_W(system_path.getStr()), nullptr, IID_PPV_ARGS(&pShellItem));
+ HRESULT hr = SHCreateItemFromParsingName(o3tl::toW(system_path.getStr()), nullptr, IID_PPV_ARGS(&pShellItem));
if ( SUCCEEDED(hr) && pShellItem )
{
@@ -869,7 +870,7 @@ void WinSalInstance::AddToRecentDocumentList(const OUString& rFileUrl, const OUS
SHARDAPPIDINFO info;
info.psi = pShellItem;
- info.pszAppID = SAL_W(sApplicationID.getStr());
+ info.pszAppID = o3tl::toW(sApplicationID.getStr());
SHAddToRecentDocs ( SHARD_APPIDINFO, &info );
return;
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 19c6424e6dfd..53de8bcad5ba 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -34,6 +34,7 @@
#include <osl/file.hxx>
#include <osl/process.h>
#include <rtl/bootstrap.hxx>
+#include <o3tl/char16_t2wchar_t.hxx>
#include <tools/helpers.hxx>
#include <tools/stream.hxx>
#include <unotools/fontcfg.hxx>
@@ -527,7 +528,7 @@ static FontAttributes WinFont2DevFontAttributes( const ENUMLOGFONTEXW& rEnumFont
aDFA.SetSymbolFlag(rLogFont.lfCharSet == SYMBOL_CHARSET);
// get the font face name
- aDFA.SetFamilyName(SAL_U(rLogFont.lfFaceName));
+ aDFA.SetFamilyName(o3tl::toU(rLogFont.lfFaceName));
// use the face's style name only if it looks reasonable
const wchar_t* pStyleName = rEnumFont.elfStyle;
@@ -537,7 +538,7 @@ static FontAttributes WinFont2DevFontAttributes( const ENUMLOGFONTEXW& rEnumFont
if( *p < 0x0020 )
break;
if( p < pEnd )
- aDFA.SetStyleName(SAL_U(pStyleName));
+ aDFA.SetStyleName(o3tl::toU(pStyleName));
// heuristics for font quality
// - opentypeTT > truetype
@@ -571,7 +572,7 @@ static WinFontFace* ImplLogMetricToDevFontDataW( const ENUMLOGFONTEXW* pLogFont,
void ImplSalLogFontToFontW( HDC hDC, const LOGFONTW& rLogFont, Font& rFont )
{
- OUString aFontName( SAL_U(rLogFont.lfFaceName) );
+ OUString aFontName( o3tl::toU(rLogFont.lfFaceName) );
if (!aFontName.isEmpty())
{
rFont.SetFamilyName( aFontName );
@@ -945,7 +946,7 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricDataRef& rxFontMetric, int nFa
wchar_t aFaceName[LF_FACESIZE+60];
if( GetTextFaceW( getHDC(), SAL_N_ELEMENTS(aFaceName), aFaceName ) )
- rxFontMetric->SetFamilyName(SAL_U(aFaceName));
+ rxFontMetric->SetFamilyName(o3tl::toU(aFaceName));
const DWORD nHheaTag = CalcTag("hhea");
const DWORD nOS2Tag = CalcTag("OS/2");
@@ -1019,7 +1020,7 @@ int CALLBACK SalEnumFontsProcExW( const LOGFONTW* lpelfe,
// Ignore vertical fonts
if ( pLogFont->elfLogFont.lfFaceName[0] != '@' )
{
- OUString aName = SAL_U(pLogFont->elfLogFont.lfFaceName);
+ OUString aName = o3tl::toU(pLogFont->elfLogFont.lfFaceName);
pInfo->mpName = &aName;
memcpy(pInfo->mpLogFont->lfFaceName, pLogFont->elfLogFont.lfFaceName, (aName.getLength()+1)*sizeof(wchar_t));
pInfo->mpLogFont->lfCharSet = pLogFont->elfLogFont.lfCharSet;
@@ -1037,7 +1038,7 @@ int CALLBACK SalEnumFontsProcExW( const LOGFONTW* lpelfe,
{
if ((nFontType & RASTER_FONTTYPE) && !(nFontType & DEVICE_FONTTYPE))
{
- SAL_INFO("vcl.gdi", "Unsupported printer font ignored: " << OUString(SAL_U(pLogFont->elfLogFont.lfFaceName)));
+ SAL_INFO("vcl.gdi", "Unsupported printer font ignored: " << OUString(o3tl::toU(pLogFont->elfLogFont.lfFaceName)));
return 1;
}
}
@@ -1046,7 +1047,7 @@ int CALLBACK SalEnumFontsProcExW( const LOGFONTW* lpelfe,
!(pMetric->ntmTm.ntmFlags & NTM_PS_OPENTYPE) &&
!(pMetric->ntmTm.ntmFlags & NTM_TT_OPENTYPE))
{
- SAL_INFO("vcl.gdi", "Unsupported font ignored: " << OUString(SAL_U(pLogFont->elfLogFont.lfFaceName)));
+ SAL_INFO("vcl.gdi", "Unsupported font ignored: " << OUString(o3tl::toU(pLogFont->elfLogFont.lfFaceName)));
return 1;
}
@@ -1072,7 +1073,7 @@ bool ImplAddTempFont( SalData& rSalData, const OUString& rFontFileURL )
OUString aUSytemPath;
OSL_VERIFY( !osl::FileBase::getSystemPathFromFileURL( rFontFileURL, aUSytemPath ) );
- nRet = AddFontResourceExW( SAL_W(aUSytemPath.getStr()), FR_PRIVATE, nullptr );
+ nRet = AddFontResourceExW( o3tl::toW(aUSytemPath.getStr()), FR_PRIVATE, nullptr );
if ( !nRet )
{
@@ -1089,7 +1090,7 @@ bool ImplAddTempFont( SalData& rSalData, const OUString& rFontFileURL )
DeleteFileW( aResourceName );
// TODO: font should be private => need to investigate why it doesn't work then
- if( !CreateScalableFontResourceW( 0, aResourceName, SAL_W(aUSytemPath.getStr()), nullptr ) )
+ if( !CreateScalableFontResourceW( 0, aResourceName, o3tl::toW(aUSytemPath.getStr()), nullptr ) )
return false;
++nCounter;
@@ -1097,7 +1098,7 @@ bool ImplAddTempFont( SalData& rSalData, const OUString& rFontFileURL )
if( nRet > 0 )
{
TempFontItem* pNewItem = new TempFontItem;
- pNewItem->maResourcePath = SAL_U( aResourceName );
+ pNewItem->maResourcePath = o3tl::toU( aResourceName );
pNewItem->maFontFilePath = aUSytemPath;
pNewItem->mpNextItem = rSalData.mpTempFontItem;
rSalData.mpTempFontItem = pNewItem;
@@ -1115,13 +1116,13 @@ void ImplReleaseTempFonts( SalData& rSalData )
++nCount;
if( p->maResourcePath.getLength() )
{
- const wchar_t* pResourcePath = SAL_W(p->maResourcePath.getStr());
+ const wchar_t* pResourcePath = o3tl::toW(p->maResourcePath.getStr());
RemoveFontResourceW( pResourcePath );
DeleteFileW( pResourcePath );
}
else
{
- RemoveFontResourceW( SAL_W(p->maFontFilePath.getStr()) );
+ RemoveFontResourceW( o3tl::toW(p->maFontFilePath.getStr()) );
}
rSalData.mpTempFontItem = p->mpNextItem;
@@ -1152,10 +1153,10 @@ static bool ImplGetFontAttrFromFile( const OUString& rFontFileURL,
DeleteFileW( aResourceName );
// Create font resource file (typically with a .fot file name extension).
- CreateScalableFontResourceW( 0, aResourceName, SAL_W(aUSytemPath.getStr()), nullptr );
+ CreateScalableFontResourceW( 0, aResourceName, o3tl::toW(aUSytemPath.getStr()), nullptr );
// Open and read the font resource file
- OUString aFotFileName = SAL_U( aResourceName );
+ OUString aFotFileName = o3tl::toU( aResourceName );
osl::FileBase::getFileURLFromSystemPath( aFotFileName, aFotFileName );
osl::File aFotFile( aFotFileName );
osl::FileBase::RC aError = aFotFile.open( osl_File_OpenFlag_Read );
diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx b/vcl/win/gdi/salnativewidgets-luna.cxx
index 22ed3bf1262a..a04fbfcf06dc 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -34,6 +34,7 @@
#include "rtl/ustring.h"
#include "osl/module.h"
+#include <o3tl/char16_t2wchar_t.hxx>
#include <opengl/win/gdiimpl.hxx>
#include <vcl/svapp.hxx>
@@ -351,7 +352,7 @@ bool ImplDrawTheme( HTHEME hTheme, HDC hDC, int iPart, int iState, RECT rc, cons
RECT rcContent;
hr = vsAPI.GetThemeBackgroundContentRect( hTheme, hDC, iPart, iState, &rc, &rcContent);
hr = vsAPI.DrawThemeText( hTheme, hDC, iPart, iState,
- SAL_W(aStr.getStr()), -1,
+ o3tl::toW(aStr.getStr()), -1,
DT_CENTER | DT_VCENTER | DT_SINGLELINE,
0, &rcContent);
}
diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index 008f9a9e5817..07c2da6d7504 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -25,6 +25,7 @@
#include <svsys.h>
#include <osl/module.h>
+#include <o3tl/char16_t2wchar_t.hxx>
#include <tools/urlobj.hxx>
@@ -162,7 +163,7 @@ void WinSalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList )
for ( i = 0; i < nInfoPrn4; i++ )
{
SalPrinterQueueInfo* pInfo = new SalPrinterQueueInfo;
- pInfo->maPrinterName = SAL_U(pWinInfo4[i].pPrinterName);
+ pInfo->maPrinterName = o3tl::toU(pWinInfo4[i].pPrinterName);
pInfo->mnStatus = PrintQueueFlags::NONE;
pInfo->mnJobs = 0;
pInfo->mpSysData = nullptr;
@@ -176,7 +177,7 @@ void WinSalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList )
void WinSalInstance::GetPrinterQueueState( SalPrinterQueueInfo* pInfo )
{
HANDLE hPrinter = nullptr;
- LPWSTR pPrnName = const_cast<LPWSTR>(SAL_W(pInfo->maPrinterName.getStr()));
+ LPWSTR pPrnName = const_cast<LPWSTR>(o3tl::toW(pInfo->maPrinterName.getStr()));
if( OpenPrinterW( pPrnName, &hPrinter, nullptr ) )
{
DWORD nBytes = 0;
@@ -187,18 +188,18 @@ void WinSalInstance::GetPrinterQueueState( SalPrinterQueueInfo* pInfo )
if( GetPrinterW( hPrinter, 2, reinterpret_cast<LPBYTE>(pWinInfo2), nBytes, &nBytes ) )
{
if( pWinInfo2->pDriverName )
- pInfo->maDriver = SAL_U(pWinInfo2->pDriverName);
+ pInfo->maDriver = o3tl::toU(pWinInfo2->pDriverName);
OUString aPortName;
if ( pWinInfo2->pPortName )
- aPortName = SAL_U(pWinInfo2->pPortName);
+ aPortName = o3tl::toU(pWinInfo2->pPortName);
// pLocation can be 0 (the Windows docu doesn't describe this)
if ( pWinInfo2->pLocation && *pWinInfo2->pLocation )
- pInfo->maLocation = SAL_U(pWinInfo2->pLocation);
+ pInfo->maLocation = o3tl::toU(pWinInfo2->pLocation);
else
pInfo->maLocation = aPortName;
// pComment can be 0 (the Windows docu doesn't describe this)
if ( pWinInfo2->pComment )
- pInfo->maComment = SAL_U(pWinInfo2->pComment);
+ pInfo->maComment = o3tl::toU(pWinInfo2->pComment);
pInfo->mnStatus = ImplWinQueueStatusToSal( pWinInfo2->Status );
pInfo->mnJobs = pWinInfo2->cJobs;
if( ! pInfo->mpSysData )
@@ -226,7 +227,7 @@ OUString WinSalInstance::GetDefaultPrinter()
OUString aDefPrt;
if( GetDefaultPrinterW( pStr, &nChars ) )
{
- aDefPrt = SAL_U(pStr);
+ aDefPrt = o3tl::toU(pStr);
}
rtl_freeMemory( pStr );
if( !aDefPrt.isEmpty() )
@@ -243,7 +244,7 @@ OUString WinSalInstance::GetDefaultPrinter()
wchar_t* pTmp = pBuf;
while ( *pTmp && (*pTmp != ',') )
pTmp++;
- return OUString( SAL_U(pBuf), static_cast<sal_Int32>(pTmp-pBuf) );
+ return OUString( o3tl::toU(pBuf), static_cast<sal_Int32>(pTmp-pBuf) );
}
else
return OUString();
@@ -258,8 +259,8 @@ static DWORD ImplDeviceCaps( WinSalInfoPrinter const * pPrinter, WORD nCaps,
else
pDevMode = SAL_DEVMODE_W( pSetupData );
- return DeviceCapabilitiesW( SAL_W(pPrinter->maDeviceName.getStr()),
- SAL_W(pPrinter->maPortName.getStr()),
+ return DeviceCapabilitiesW( o3tl::toW(pPrinter->maDeviceName.getStr()),
+ o3tl::toW(pPrinter->maPortName.getStr()),
nCaps, reinterpret_cast<LPWSTR>(pOutput), pDevMode );
}
@@ -288,7 +289,7 @@ static bool ImplTestSalJobSetup( WinSalInfoPrinter const * pPrinter,
// can avoid potential driver crashes as their jobsetups are often not compatible
// #110800#, #111151#, #112381#, #i16580#, #i14173# and perhaps #112375#
HANDLE hPrn;
- LPWSTR pPrinterNameW = const_cast<LPWSTR>(SAL_W(pPrinter->maDeviceName.getStr()));
+ LPWSTR pPrinterNameW = const_cast<LPWSTR>(o3tl::toW(pPrinter->maDeviceName.getStr()));
if ( !OpenPrinterW( pPrinterNameW, &hPrn, nullptr ) )
return FALSE;
@@ -350,7 +351,7 @@ static bool ImplUpdateSalJobSetup( WinSalInfoPrinter const * pPrinter, ImplJobSe
bool bIn, WinSalFrame* pVisibleDlgParent )
{
HANDLE hPrn;
- LPWSTR pPrinterNameW = const_cast<LPWSTR>(SAL_W(pPrinter->maDeviceName.getStr()));
+ LPWSTR pPrinterNameW = const_cast<LPWSTR>(o3tl::toW(pPrinter->maDeviceName.getStr()));
if ( !OpenPrinterW( pPrinterNameW, &hPrn, nullptr ) )
return FALSE;
// #131642# hPrn==HGDI_ERROR even though OpenPrinter() succeeded!
@@ -418,13 +419,13 @@ static bool ImplUpdateSalJobSetup( WinSalInfoPrinter const * pPrinter, ImplJobSe
// fill up string buffers with 0 so they do not influence a JobSetup's memcmp
if( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmSize >= 64 )
{
- sal_Int32 nLen = rtl_ustr_getLength( SAL_U(reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmDeviceName) );
+ sal_Int32 nLen = rtl_ustr_getLength( o3tl::toU(reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmDeviceName) );
if ( sal::static_int_cast<size_t>(nLen) < SAL_N_ELEMENTS( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmDeviceName ) )
memset( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmDeviceName+nLen, 0, sizeof( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmDeviceName )-(nLen*sizeof(sal_Unicode)) );
}
if( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmSize >= 166 )
{
- sal_Int32 nLen = rtl_ustr_getLength( SAL_U(reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmFormName) );
+ sal_Int32 nLen = rtl_ustr_getLength( o3tl::toU(reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmFormName) );
if ( sal::static_int_cast<size_t>(nLen) < SAL_N_ELEMENTS( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmFormName ) )
memset( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmFormName+nLen, 0, sizeof( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmFormName )-(nLen*sizeof(sal_Unicode)) );
}
@@ -1023,8 +1024,8 @@ static HDC ImplCreateSalPrnIC( WinSalInfoPrinter const * pPrinter, const ImplJob
memset( pDriverName+pPrinter->maDriverName.getLength(), 0, 32 );
memcpy( pDeviceName, pPrinter->maDeviceName.getStr(), pPrinter->maDeviceName.getLength()*sizeof(sal_Unicode));
memset( pDeviceName+pPrinter->maDeviceName.getLength(), 0, 32 );
- hDC = ImplCreateICW_WithCatch( SAL_W(pDriverName),
- SAL_W(pDeviceName),
+ hDC = ImplCreateICW_WithCatch( o3tl::toW(pDriverName),
+ o3tl::toW(pDeviceName),
pDevMode );
return hDC;
}
@@ -1438,8 +1439,8 @@ bool WinSalPrinter::StartJob( const OUString* pFileName,
sal_Unicode aDevBuf[4096];
memcpy( aDrvBuf, mpInfoPrinter->maDriverName.getStr(), (mpInfoPrinter->maDriverName.getLength()+1)*sizeof(sal_Unicode));
memcpy( aDevBuf, mpInfoPrinter->maDeviceName.getStr(), (mpInfoPrinter->maDeviceName.getLength()+1)*sizeof(sal_Unicode));
- hDC = CreateDCW( SAL_W(aDrvBuf),
- SAL_W(aDevBuf),
+ hDC = CreateDCW( o3tl::toW(aDrvBuf),
+ o3tl::toW(aDevBuf),
nullptr,
pDevModeW );
@@ -1493,12 +1494,12 @@ bool WinSalPrinter::StartJob( const OUString* pFileName,
DOCINFOW aInfo;
memset( &aInfo, 0, sizeof( DOCINFOW ) );
aInfo.cbSize = sizeof( aInfo );
- aInfo.lpszDocName = SAL_W(rJobName.getStr());
+ aInfo.lpszDocName = o3tl::toW(rJobName.getStr());
if ( pFileName || aOutFileName.getLength() )
{
if ( (pFileName && !pFileName->isEmpty()) || aOutFileName.getLength() )
{
- aInfo.lpszOutput = SAL_W((pFileName && !pFileName->isEmpty()) ? pFileName->getStr() : aOutFileName.getStr());
+ aInfo.lpszOutput = o3tl::toW((pFileName && !pFileName->isEmpty()) ? pFileName->getStr() : aOutFileName.getStr());
}
else
aInfo.lpszOutput = L"FILE:";
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index e8a7c5090172..622fa7bba2b2 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -41,6 +41,7 @@
#include <tools/debug.hxx>
#include <o3tl/enumarray.hxx>
+#include <o3tl/char16_t2wchar_t.hxx>
#include <vcl/sysdata.hxx>
#include <vcl/timer.hxx>
@@ -1070,7 +1071,7 @@ void WinSalFrame::SetTitle( const OUString& rTitle )
{
static_assert( sizeof( WCHAR ) == sizeof( sal_Unicode ), "must be the same size" );
- SetWindowTextW( mhWnd, SAL_W(rTitle.getStr()) );
+ SetWindowTextW( mhWnd, o3tl::toW(rTitle.getStr()) );
}
void WinSalFrame::SetIcon( sal_uInt16 nIcon )
@@ -1844,7 +1845,7 @@ void WinSalFrame::SetApplicationID( const OUString &rApplicationID )
PROPVARIANT pv;
if ( !rApplicationID.isEmpty() )
{
- hr = InitPropVariantFromString( SAL_W(rApplicationID.getStr()), &pv );
+ hr = InitPropVariantFromString( o3tl::toW(rApplicationID.getStr()), &pv );
mbPropertiesStored = TRUE;
}
else
@@ -2303,7 +2304,7 @@ static void ImplGetKeyNameText( LONG lParam, sal_Unicode* pBuf,
else
{
nKeyLen = aRet.getLength();
- wcscpy( aKeyBuf, SAL_W( aRet.getStr() ));
+ wcscpy( aKeyBuf, o3tl::toW( aRet.getStr() ));
}
}
@@ -2554,7 +2555,7 @@ static void ImplSalUpdateStyleFontW( HDC hDC, const LOGFONTW& rLogFont, vcl::Fon
// 6 Point is the smallest one
if ( rFont.GetFontHeight() < 8 )
{
- if ( rtl_ustr_compareIgnoreAsciiCase( SAL_U(rLogFont.lfFaceName), SAL_U(L"MS Sans Serif") ) == 0 )
+ if ( rtl_ustr_compareIgnoreAsciiCase( o3tl::toU(rLogFont.lfFaceName), o3tl::toU(L"MS Sans Serif") ) == 0 )
rFont.SetFontHeight( 8 );
else if ( rFont.GetFontHeight() < 6 )
rFont.SetFontHeight( 6 );
@@ -4453,7 +4454,7 @@ static int ImplMeasureItem( HWND hWnd, WPARAM wParam, LPARAM lParam )
aStr += " ";
aStr += pSalMenuItem->mAccelText;
}
- GetTextExtentPoint32W( hdc, SAL_W(aStr.getStr()),
+ GetTextExtentPoint32W( hdc, o3tl::toW(aStr.getStr()),
aStr.getLength(), &strSize );
// image
@@ -4590,7 +4591,7 @@ static int ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam )
SIZE strSize;
OUString aStr( pSalMenuItem->mText );
- GetTextExtentPoint32W( pDI->hDC, SAL_W(aStr.getStr()),
+ GetTextExtentPoint32W( pDI->hDC, o3tl::toW(aStr.getStr()),
aStr.getLength(), &strSize );
if(!DrawStateW( pDI->hDC, nullptr, nullptr,
@@ -4603,7 +4604,7 @@ static int ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam )
{
SIZE strSizeA;
aStr = pSalMenuItem->mAccelText;
- GetTextExtentPoint32W( pDI->hDC, SAL_W(aStr.getStr()),
+ GetTextExtentPoint32W( pDI->hDC, o3tl::toW(aStr.getStr()),
aStr.getLength(), &strSizeA );
TEXTMETRICW tm;
GetTextMetricsW( pDI->hDC, &tm );
@@ -4969,7 +4970,7 @@ static bool ImplHandleIMECompositionInput( WinSalFrame* pFrame,
{
auto pTextBuf = std::unique_ptr<WCHAR[]>(new WCHAR[nTextLen]);
ImmGetCompositionStringW( hIMC, GCS_RESULTSTR, pTextBuf.get(), nTextLen*sizeof( WCHAR ) );
- aEvt.maText = OUString( SAL_U(pTextBuf.get()), (sal_Int32)nTextLen );
+ aEvt.maText = OUString( o3tl::toU(pTextBuf.get()), (sal_Int32)nTextLen );
}
aEvt.mnCursorPos = aEvt.maText.getLength();
@@ -4995,7 +4996,7 @@ static bool ImplHandleIMECompositionInput( WinSalFrame* pFrame,
{
auto pTextBuf = std::unique_ptr<WCHAR>(new WCHAR[nTextLen]);
ImmGetCompositionStringW( hIMC, GCS_COMPSTR, pTextBuf.get(), nTextLen*sizeof( WCHAR ) );
- aEvt.maText = OUString( SAL_U(pTextBuf.get()), (sal_Int32)nTextLen );
+ aEvt.maText = OUString( o3tl::toU(pTextBuf.get()), (sal_Int32)nTextLen );
}
std::unique_ptr<BYTE> pAttrBuf;
diff --git a/vcl/win/window/salmenu.cxx b/vcl/win/window/salmenu.cxx
index 5ca16c496829..592813759e88 100644
--- a/vcl/win/window/salmenu.cxx
+++ b/vcl/win/window/salmenu.cxx
@@ -21,6 +21,7 @@
#include <vcl/menu.hxx>
#include <vcl/sysdata.hxx>
+#include <o3tl/char16_t2wchar_t.hxx>
#include <win/wincomp.hxx>
#include <win/saldata.hxx>
@@ -93,7 +94,7 @@ SalMenuItem* WinSalInstance::CreateMenuItem( const SalItemParams* pItemData )
pSalMenuItem->mInfo.fMask = MIIM_TYPE | MIIM_STATE | MIIM_ID | MIIM_DATA;
pSalMenuItem->mInfo.fType = MFT_STRING;
- pSalMenuItem->mInfo.dwTypeData = SAL_W(const_cast<sal_Unicode *>(pSalMenuItem->mText.getStr()));
+ pSalMenuItem->mInfo.dwTypeData = o3tl::toW(const_cast<sal_Unicode *>(pSalMenuItem->mText.getStr()));
pSalMenuItem->mInfo.cch = pSalMenuItem->mText.getLength();
pSalMenuItem->mInfo.wID = pItemData->nId;
@@ -307,7 +308,7 @@ void WinSalMenu::SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const OU
{
aStr += "\t" + pWItem->mAccelText;
}
- pWItem->mInfo.dwTypeData = SAL_W(const_cast<sal_Unicode *>(aStr.getStr()));
+ pWItem->mInfo.dwTypeData = o3tl::toW(const_cast<sal_Unicode *>(aStr.getStr()));
pWItem->mInfo.cch = aStr.getLength();
if(!::SetMenuItemInfoW( mhMenu, nPos, TRUE, &pWItem->mInfo ))
@@ -332,7 +333,7 @@ void WinSalMenu::SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const
{
aStr += "\t" + pWItem->mAccelText;
}
- pWItem->mInfo.dwTypeData = SAL_W(const_cast<sal_Unicode *>(aStr.getStr()));
+ pWItem->mInfo.dwTypeData = o3tl::toW(const_cast<sal_Unicode *>(aStr.getStr()));
pWItem->mInfo.cch = aStr.getLength();
if(!::SetMenuItemInfoW( mhMenu, nPos, TRUE, &pWItem->mInfo ))