diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2017-10-05 06:19:56 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2017-10-05 16:02:52 +0200 |
commit | 1944e3ddc0b2247de3138d2a441cd6999e21fd9a (patch) | |
tree | b59f213e245e151ee792ca424fd06b5a11c88857 /embeddedobj | |
parent | 81d404803f477eb71b74eb9c7a67bba6b1af95d1 (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 'embeddedobj')
-rw-r--r-- | embeddedobj/source/msole/olecomponent.cxx | 27 |
1 files changed, 14 insertions, 13 deletions
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 <com/sun/star/io/XTruncate.hpp> #include <com/sun/star/awt/XRequestCallback.hpp> -#include <platform.h> +#include "platform.h" #include <cppuhelper/interfacecontainer.h> #include <comphelper/mimeconfighelper.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/storagehelper.hxx> #include <osl/file.hxx> #include <rtl/ref.hxx> +#include <o3tl/char16_t2wchar_t.hxx> -#include <graphconvert.hxx> -#include <olecomponent.hxx> -#include <olepersist.hxx> -#include <olewrapclient.hxx> -#include <advisesink.hxx> +#include "graphconvert.hxx" +#include "olecomponent.hxx" +#include "olepersist.hxx" +#include "olewrapclient.hxx" +#include "advisesink.hxx" #include <oleembobj.hxx> -#include <mtnotification.hxx> +#include "mtnotification.hxx" #include <memory> #include <string> @@ -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() ) ); } |