summaryrefslogtreecommitdiff
path: root/vcl/win/window
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/window
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/window')
-rw-r--r--vcl/win/window/salframe.cxx19
-rw-r--r--vcl/win/window/salmenu.cxx7
2 files changed, 14 insertions, 12 deletions
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 ))