summaryrefslogtreecommitdiff
path: root/fpicker/source
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 /fpicker/source
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 'fpicker/source')
-rw-r--r--fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx31
-rw-r--r--fpicker/source/win32/folderpicker/MtaFop.cxx11
2 files changed, 22 insertions, 20 deletions
diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
index f435811ec62a..430ac9d208b1 100644
--- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
+++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
@@ -30,6 +30,7 @@
#include <osl/file.hxx>
#include <osl/mutex.hxx>
#include <rtl/process.h>
+#include <o3tl/char16_t2wchar_t.hxx>
#include "../misc/WinImplHelper.hxx"
#include <shlguid.h>
@@ -59,7 +60,7 @@ bool createFolderItem(OUString const & url, ComPtr<IShellItem> & folder) {
return false;
}
HRESULT res = SHCreateItemFromParsingName(
- SAL_W(path.getStr()), nullptr,
+ o3tl::toW(path.getStr()), nullptr,
IID_PPV_ARGS(&folder));
return SUCCEEDED(res);
}
@@ -104,11 +105,11 @@ OUString lcl_getURLFromShellItem (IShellItem* pItem)
if ( FAILED(hr) )
return OUString();
- sURL = SAL_U(pStr);
+ sURL = o3tl::toU(pStr);
}
else
{
- ::osl::FileBase::getFileURLFromSystemPath( SAL_U(pStr), sURL );
+ ::osl::FileBase::getFileURLFromSystemPath( o3tl::toU(pStr), sURL );
}
CoTaskMemFree (pStr);
@@ -126,8 +127,8 @@ OUString lcl_getURLFromShellItem (IShellItem* pItem)
{
COMDLG_FILTERSPEC aSpec;
- aSpec.pszName = SAL_W(aFilter.first.getStr()) ;
- aSpec.pszSpec = SAL_W(aFilter.second.getStr());
+ aSpec.pszName = o3tl::toW(aFilter.first.getStr()) ;
+ aSpec.pszSpec = o3tl::toW(aFilter.second.getStr());
lList.push_back(aSpec);
}
@@ -495,7 +496,7 @@ static void setLabelToControl(TFileDialogCustomize iCustom, sal_uInt16 nControlI
{
OUString aLabel = CResourceProvider::getResString(nControlId);
aLabel = SOfficeToWindowsLabel(aLabel);
- iCustom->SetControlLabel(nControlId, SAL_W(aLabel.getStr()) );
+ iCustom->SetControlLabel(nControlId, o3tl::toW(aLabel.getStr()) );
}
@@ -660,7 +661,7 @@ void VistaFilePickerImpl::impl_sta_SetTitle(const RequestRef& rRequest)
aLock.clear();
// <- SYNCHRONIZED
- iDialog->SetTitle(SAL_W(sTitle.getStr()));
+ iDialog->SetTitle(o3tl::toW(sTitle.getStr()));
}
@@ -674,7 +675,7 @@ void VistaFilePickerImpl::impl_sta_SetFileName(const RequestRef& rRequest)
aLock.clear();
// <- SYNCHRONIZED
- iDialog->SetFileName(SAL_W(sFileName.getStr()));
+ iDialog->SetFileName(o3tl::toW(sFileName.getStr()));
}
@@ -747,7 +748,7 @@ void VistaFilePickerImpl::impl_sta_SetDefaultName(const RequestRef& rRequest)
sFilename = sFilename.copy(0, nSepPos);
}
- iDialog->SetFileName (SAL_W(sFilename.getStr()));
+ iDialog->SetFileName (o3tl::toW(sFilename.getStr()));
m_sFilename = sFilename;
}
@@ -920,7 +921,7 @@ void VistaFilePickerImpl::impl_sta_ShowDialogModal(const RequestRef& rRequest)
lpFilterExt = wcsrchr( lpFilterExt, '.' );
if ( lpFilterExt )
- aFileURL += SAL_U(lpFilterExt);
+ aFileURL += o3tl::toU(lpFilterExt);
}
}
}
@@ -930,7 +931,7 @@ void VistaFilePickerImpl::impl_sta_ShowDialogModal(const RequestRef& rRequest)
osl_getSystemPathFromFileURL( aFileURL.pData, &aSystemPath.pData );
WIN32_FIND_DATAW aFindFileData;
- HANDLE hFind = FindFirstFileW( SAL_W(aSystemPath.getStr()), &aFindFileData );
+ HANDLE hFind = FindFirstFileW( o3tl::toW(aSystemPath.getStr()), &aFindFileData );
if (hFind != INVALID_HANDLE_VALUE)
iDialog->SetFolder(pFolder);
else
@@ -1067,7 +1068,7 @@ void VistaFilePickerImpl::impl_sta_SetControlValue(const RequestRef& rRequest)
for (::sal_Int32 i=0; i<lItems.getLength(); ++i)
{
const OUString& sItem = lItems[i];
- hResult = iCustom->AddControlItem(nId, i, SAL_W(sItem.getStr()));
+ hResult = iCustom->AddControlItem(nId, i, o3tl::toW(sItem.getStr()));
}
}
break;
@@ -1137,7 +1138,7 @@ void VistaFilePickerImpl::impl_sta_SetControlLabel(const RequestRef& rRequest)
TFileDialogCustomize iCustom = impl_getCustomizeInterface();
if ( ! iCustom.is())
return;
- iCustom->SetControlLabel (nId, SAL_W(sLabel.getStr()));
+ iCustom->SetControlLabel (nId, o3tl::toW(sLabel.getStr()));
}
@@ -1183,7 +1184,7 @@ void VistaFilePickerImpl::impl_SetDefaultExtension( const OUString& currentFilte
posOfSemiColon = FilterExt.getLength() - 1;
FilterExt = OUString(pFirstExtStart, posOfSemiColon - posOfPoint);
- iDialog->SetDefaultExtension ( SAL_W(FilterExt.getStr()) );
+ iDialog->SetDefaultExtension ( o3tl::toW(FilterExt.getStr()) );
}
}
@@ -1205,7 +1206,7 @@ void VistaFilePickerImpl::onAutoExtensionChanged (bool bChecked)
PCWSTR pExt = nullptr;
if ( bChecked )
{
- pExt = SAL_W(sExt.getStr());
+ pExt = o3tl::toW(sExt.getStr());
pExt = wcsrchr( pExt, '.' );
if ( pExt )
pExt++;
diff --git a/fpicker/source/win32/folderpicker/MtaFop.cxx b/fpicker/source/win32/folderpicker/MtaFop.cxx
index b0bd86550f52..4958699a7e5d 100644
--- a/fpicker/source/win32/folderpicker/MtaFop.cxx
+++ b/fpicker/source/win32/folderpicker/MtaFop.cxx
@@ -19,6 +19,7 @@
#include <osl/diagnose.h>
#include <osl/thread.h>
+#include <o3tl/char16_t2wchar_t.hxx>
#include "MtaFop.hxx"
#include <wchar.h>
@@ -364,10 +365,10 @@ bool SAL_CALL CMtaFolderPicker::onBrowseForFolder( )
// pre SHBrowseFroFolder
m_bi.pidlRoot = nullptr;
- m_bi.pszDisplayName = SAL_W(m_pathBuff);
+ m_bi.pszDisplayName = o3tl::toW(m_pathBuff);
if ( m_Description.getLength( ) )
- m_bi.lpszTitle = SAL_W(m_Description.getStr( ));
+ m_bi.lpszTitle = o3tl::toW(m_Description.getStr( ));
lpiid = SHBrowseForFolderW( &m_bi );
bRet = ( nullptr != lpiid );
@@ -409,7 +410,7 @@ LPITEMIDLIST SAL_CALL CMtaFolderPicker::getItemIdListFromPath( const OUString& a
pIShellFolder->ParseDisplayName(
nullptr,
nullptr,
- const_cast<LPWSTR>(SAL_W( aDirectory.getStr( ) )),
+ const_cast<LPWSTR>(o3tl::toW( aDirectory.getStr( ) )),
nullptr,
&lpItemIdList,
nullptr );
@@ -425,7 +426,7 @@ OUString SAL_CALL CMtaFolderPicker::getPathFromItemIdList( LPCITEMIDLIST lpItemI
if ( lpItemIdList )
{
- bool bRet = SHGetPathFromIDListW( lpItemIdList, SAL_W(m_pathBuff) );
+ bool bRet = SHGetPathFromIDListW( lpItemIdList, o3tl::toW(m_pathBuff) );
if ( bRet )
path = m_pathBuff;
}
@@ -506,7 +507,7 @@ int CALLBACK CMtaFolderPicker::FolderPickerCallback( HWND hwnd, UINT uMsg, LPARA
case BFFM_INITIALIZED:
pImpl->m_hwnd = hwnd;
pImpl->onInitialized( );
- SetWindowTextW( hwnd, SAL_W(pImpl->m_dialogTitle.getStr()) );
+ SetWindowTextW( hwnd, o3tl::toW(pImpl->m_dialogTitle.getStr()) );
break;
case BFFM_SELCHANGED: