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 --- embeddedobj/source/msole/olecomponent.cxx | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'embeddedobj') diff --git a/embeddedobj/source/msole/olecomponent.cxx b/embeddedobj/source/msole/olecomponent.cxx index 48cba783fcfd..738d87fa6452 100644 --- a/embeddedobj/source/msole/olecomponent.cxx +++ b/embeddedobj/source/msole/olecomponent.cxx @@ -30,21 +30,22 @@ #include #include -#include +#include "platform.h" #include #include #include #include #include #include +#include -#include -#include -#include -#include -#include +#include "graphconvert.hxx" +#include "olecomponent.hxx" +#include "olepersist.hxx" +#include "olewrapclient.hxx" +#include "advisesink.hxx" #include -#include +#include "mtnotification.hxx" #include #include @@ -262,7 +263,7 @@ HRESULT OpenIStorageFromURL_Impl( const OUString& aURL, IStorage** ppIStorage ) if ( !ppIStorage || ::osl::FileBase::getSystemPathFromFileURL( aURL, aFilePath ) != ::osl::FileBase::E_None ) throw uno::RuntimeException(); // TODO: something dangerous happened - return StgOpenStorage( SAL_W(aFilePath.getStr()), + return StgOpenStorage( o3tl::toW(aFilePath.getStr()), nullptr, STGM_READWRITE | STGM_TRANSACTED, // | STGM_DELETEONRELEASE, nullptr, @@ -546,7 +547,7 @@ void OleComponent::CreateNewIStorage_Impl() if ( ::osl::FileBase::getSystemPathFromFileURL( aTempURL, aTempFilePath ) != ::osl::FileBase::E_None ) throw uno::RuntimeException(); // TODO: something dangerous happened - HRESULT hr = StgCreateDocfile( SAL_W(aTempFilePath.getStr()), STGM_CREATE | STGM_READWRITE | STGM_TRANSACTED | STGM_DELETEONRELEASE, 0, &m_pNativeImpl->m_pIStorage ); + HRESULT hr = StgCreateDocfile( o3tl::toW(aTempFilePath.getStr()), STGM_CREATE | STGM_READWRITE | STGM_TRANSACTED | STGM_DELETEONRELEASE, 0, &m_pNativeImpl->m_pIStorage ); if ( FAILED( hr ) || !m_pNativeImpl->m_pIStorage ) throw io::IOException(); // TODO: transport error code? } @@ -827,7 +828,7 @@ void OleComponent::CreateObjectFromFile( const OUString& aFileURL ) throw uno::RuntimeException(); // TODO: something dangerous happened HRESULT hr = OleCreateFromFile( CLSID_NULL, - SAL_W(aFilePath.getStr()), + o3tl::toW(aFilePath.getStr()), IID_IUnknown, OLERENDER_DRAW, // OLERENDER_FORMAT nullptr, @@ -856,7 +857,7 @@ void OleComponent::CreateLinkFromFile( const OUString& aFileURL ) if ( ::osl::FileBase::getSystemPathFromFileURL( aFileURL, aFilePath ) != ::osl::FileBase::E_None ) throw uno::RuntimeException(); // TODO: something dangerous happened - HRESULT hr = OleCreateLinkToFile( SAL_W(aFilePath.getStr()), + HRESULT hr = OleCreateLinkToFile( o3tl::toW(aFilePath.getStr()), IID_IUnknown, OLERENDER_DRAW, // OLERENDER_FORMAT nullptr, @@ -1036,7 +1037,7 @@ uno::Sequence< embed::VerbDescriptor > OleComponent::GetVerbList() for( sal_uInt32 nInd = 0; nInd < nNum; nInd++ ) { m_aVerbList[nSeqSize-nNum+nInd].VerbID = szEle[ nInd ].lVerb; - m_aVerbList[nSeqSize-nNum+nInd].VerbName = WinAccToVcl_Impl( SAL_U(szEle[ nInd ].lpszVerbName) ); + m_aVerbList[nSeqSize-nNum+nInd].VerbName = WinAccToVcl_Impl( o3tl::toU(szEle[ nInd ].lpszVerbName) ); m_aVerbList[nSeqSize-nNum+nInd].VerbFlags = szEle[ nInd ].fuFlags; m_aVerbList[nSeqSize-nNum+nInd].VerbAttributes = szEle[ nInd ].grfAttribs; } @@ -1076,7 +1077,7 @@ void OleComponent::SetHostName( const OUString&, if ( !m_pNativeImpl->m_pOleObject ) throw embed::WrongStateException(); // TODO: the object is in wrong state - m_pNativeImpl->m_pOleObject->SetHostNames( L"app name", SAL_W( aEmbDocName.getStr() ) ); + m_pNativeImpl->m_pOleObject->SetHostNames( L"app name", o3tl::toW( aEmbDocName.getStr() ) ); } -- cgit