From bad606febb291022140cb4fb637005cfafff6f98 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 10 Apr 2017 10:16:11 +0200 Subject: Clean up uses of SAL_U/SAL_W: embedserv Change-Id: I5a73acf6ccfc1709e95e55fa15c32ec6dda2657a --- embedserv/source/embed/ed_ioleobject.cxx | 9 +++--- embedserv/source/embed/ed_ipersiststr.cxx | 17 +++++------ embedserv/source/embed/guid.cxx | 48 +++++++++++++++---------------- embedserv/source/embed/guid.hxx | 5 ++-- embedserv/source/embed/tracker.cxx | 6 ++-- embedserv/source/inc/stdafx.h | 6 ++++ 6 files changed, 50 insertions(+), 41 deletions(-) (limited to 'embedserv') diff --git a/embedserv/source/embed/ed_ioleobject.cxx b/embedserv/source/embed/ed_ioleobject.cxx index 965337547ecd..17905f13929a 100644 --- a/embedserv/source/embed/ed_ioleobject.cxx +++ b/embedserv/source/embed/ed_ioleobject.cxx @@ -46,11 +46,9 @@ STDMETHODIMP EmbedDocument_Impl::SetHostNames( LPCOLESTR szContainerApp, LPCOLES if ( !m_aFileName.getLength() ) { m_pDocHolder->setTitle( - OUString( - SAL_U(szContainerObj))); + OUString(reinterpret_cast(szContainerObj))); m_pDocHolder->setContainerName( - OUString( - SAL_U(szContainerApp))); + OUString(reinterpret_cast(szContainerApp))); } return S_OK; @@ -424,7 +422,8 @@ HRESULT EmbedDocument_Impl::SaveObject() // in case of links the containers does not provide client site sometimes hr = Save( static_cast(nullptr), FALSE ); // triggers saving to the link location - SaveCompleted( SAL_W(aPreservFileName.getStr()) ); + SaveCompleted( + reinterpret_cast(aPreservFileName.getStr())); } notify( false ); diff --git a/embedserv/source/embed/ed_ipersiststr.cxx b/embedserv/source/embed/ed_ipersiststr.cxx index 528df24b3bb5..dc8a36ccd2bf 100644 --- a/embedserv/source/embed/ed_ipersiststr.cxx +++ b/embedserv/source/embed/ed_ipersiststr.cxx @@ -37,6 +37,7 @@ #include #include +#include #include #include #include @@ -399,7 +400,7 @@ STDMETHODIMP EmbedDocument_Impl::InitNew( IStorage *pStg ) if ( m_xFactory.is() && pStg ) { uno::Reference< frame::XModel > aDocument( - m_xFactory->createInstance( getServiceNameFromGUID_Impl( &m_guid ) ), + m_xFactory->createInstance( o3tl::toOUString(getServiceNameFromGUID_Impl( &m_guid )) ), uno::UNO_QUERY ); if ( aDocument.is() ) { @@ -421,11 +422,11 @@ STDMETHODIMP EmbedDocument_Impl::InitNew( IStorage *pStg ) if ( hr == S_OK ) { - OUString aCurType = getStorageTypeFromGUID_Impl( &m_guid ); // ??? + wchar_t const * aCurType = getStorageTypeFromGUID_Impl( &m_guid ); // ??? CLIPFORMAT cf = (CLIPFORMAT)RegisterClipboardFormatA( "Embedded Object" ); hr = WriteFmtUserTypeStg( pStg, cf, // ??? - SAL_W(const_cast(aCurType.getStr())) ); + const_cast(aCurType) ); if ( hr == S_OK ) { @@ -534,7 +535,7 @@ STDMETHODIMP EmbedDocument_Impl::Load( IStorage *pStg ) if ( xTempIn.is() ) { uno::Reference< frame::XModel > aDocument( - m_xFactory->createInstance( getServiceNameFromGUID_Impl( &m_guid ) ), + m_xFactory->createInstance( o3tl::toOUString(getServiceNameFromGUID_Impl( &m_guid )) ), uno::UNO_QUERY ); if ( aDocument.is() ) { @@ -749,11 +750,11 @@ STDMETHODIMP EmbedDocument_Impl::Load( LPCOLESTR pszFileName, DWORD /*dwMode*/ ) if ( FAILED( hr ) || !m_pMasterStorage ) return E_FAIL; - OUString aCurType = getServiceNameFromGUID_Impl( &m_guid ); // ??? + o3tl::u16string_view aCurType = getServiceNameFromGUID_Impl( &m_guid ); // ??? CLIPFORMAT cf = (CLIPFORMAT)RegisterClipboardFormatA( "Embedded Object" ); hr = WriteFmtUserTypeStg( m_pMasterStorage, cf, // ??? - SAL_W(const_cast(aCurType.getStr())) ); + const_cast(reinterpret_cast(aCurType.data())) ); if ( FAILED( hr ) ) return E_FAIL; hr = m_pMasterStorage->SetClass( m_guid ); @@ -775,7 +776,7 @@ STDMETHODIMP EmbedDocument_Impl::Load( LPCOLESTR pszFileName, DWORD /*dwMode*/ ) uno::Reference< frame::XModel > aDocument( - m_xFactory->createInstance( getServiceNameFromGUID_Impl( &m_guid ) ), + m_xFactory->createInstance( o3tl::toOUString(getServiceNameFromGUID_Impl( &m_guid )) ), uno::UNO_QUERY ); if ( aDocument.is() ) { @@ -804,7 +805,7 @@ STDMETHODIMP EmbedDocument_Impl::Load( LPCOLESTR pszFileName, DWORD /*dwMode*/ ) cf = (CLIPFORMAT)RegisterClipboardFormatA( "Embedded Object" ); hr = WriteFmtUserTypeStg( m_pMasterStorage, cf, // ??? - SAL_W(const_cast(aCurType.getStr())) ); + const_cast(reinterpret_cast(aCurType.data())) ); if ( SUCCEEDED( hr ) ) { diff --git a/embedserv/source/embed/guid.cxx b/embedserv/source/embed/guid.cxx index 882408f57869..99d69bad0649 100644 --- a/embedserv/source/embed/guid.cxx +++ b/embedserv/source/embed/guid.cxx @@ -26,74 +26,74 @@ #include -OUString getStorageTypeFromGUID_Impl( GUID* guid ) +wchar_t const * getStorageTypeFromGUID_Impl( GUID* guid ) { if ( *guid == OID_WriterTextServer ) - return OUString( "soffice.StarWriterDocument.6" ); + return L"soffice.StarWriterDocument.6"; if ( *guid == OID_WriterOASISTextServer ) - return OUString( "LibreOffice.WriterDocument.1" ); + return L"LibreOffice.WriterDocument.1"; if ( *guid == OID_CalcServer ) - return OUString( "soffice.StarCalcDocument.6" ); + return L"soffice.StarCalcDocument.6"; if ( *guid == OID_CalcOASISServer ) - return OUString( "LibreOffice.CalcDocument.1" ); + return L"LibreOffice.CalcDocument.1"; if ( *guid == OID_DrawingServer ) - return OUString( "soffice.StarDrawDocument.6" ); + return L"soffice.StarDrawDocument.6"; if ( *guid == OID_DrawingOASISServer ) - return OUString( "LibreOffice.DrawDocument.1" ); + return L"LibreOffice.DrawDocument.1"; if ( *guid == OID_PresentationServer ) - return OUString( "soffice.StarImpressDocument.6" ); + return L"soffice.StarImpressDocument.6"; if ( *guid == OID_PresentationOASISServer ) - return OUString( "LibreOffice.ImpressDocument.1" ); + return L"LibreOffice.ImpressDocument.1"; if ( *guid == OID_MathServer ) - return OUString( "soffice.StarMathDocument.6" ); + return L"soffice.StarMathDocument.6"; if ( *guid == OID_MathOASISServer ) - return OUString( "LibreOffice.MathDocument.1" ); + return L"LibreOffice.MathDocument.1"; - return OUString(); + return L""; } -OUString getServiceNameFromGUID_Impl( GUID* guid ) +o3tl::u16string_view getServiceNameFromGUID_Impl( GUID* guid ) { if ( *guid == OID_WriterTextServer ) - return OUString( "com.sun.star.comp.Writer.TextDocument" ); + return u"com.sun.star.comp.Writer.TextDocument"; if ( *guid == OID_WriterOASISTextServer ) - return OUString( "com.sun.star.comp.Writer.TextDocument" ); + return u"com.sun.star.comp.Writer.TextDocument"; if ( *guid == OID_CalcServer ) - return OUString( "com.sun.star.comp.Calc.SpreadsheetDocument" ); + return u"com.sun.star.comp.Calc.SpreadsheetDocument"; if ( *guid == OID_CalcOASISServer ) - return OUString( "com.sun.star.comp.Calc.SpreadsheetDocument" ); + return u"com.sun.star.comp.Calc.SpreadsheetDocument"; if ( *guid == OID_DrawingServer ) - return OUString( "com.sun.star.comp.Draw.DrawingDocument" ); + return u"com.sun.star.comp.Draw.DrawingDocument"; if ( *guid == OID_DrawingOASISServer ) - return OUString( "com.sun.star.comp.Draw.DrawingDocument" ); + return u"com.sun.star.comp.Draw.DrawingDocument"; if ( *guid == OID_PresentationServer ) - return OUString( "com.sun.star.comp.Draw.PresentationDocument" ); + return u"com.sun.star.comp.Draw.PresentationDocument"; if ( *guid == OID_PresentationOASISServer ) - return OUString( "com.sun.star.comp.Draw.PresentationDocument" ); + return u"com.sun.star.comp.Draw.PresentationDocument"; if ( *guid == OID_MathServer ) - return OUString( "com.sun.star.comp.Math.FormulaDocument" ); + return u"com.sun.star.comp.Math.FormulaDocument"; if ( *guid == OID_MathOASISServer ) - return OUString( "com.sun.star.comp.Math.FormulaDocument" ); + return u"com.sun.star.comp.Math.FormulaDocument"; - return OUString(); + return u""; } OUString getFilterNameFromGUID_Impl( GUID* guid ) diff --git a/embedserv/source/embed/guid.hxx b/embedserv/source/embed/guid.hxx index a970fb4fb8e4..de919aa5ea7c 100644 --- a/embedserv/source/embed/guid.hxx +++ b/embedserv/source/embed/guid.hxx @@ -22,15 +22,16 @@ #include +#include #include #include OUString getFilterNameFromGUID_Impl( GUID* ); -OUString getServiceNameFromGUID_Impl( GUID* ); +o3tl::u16string_view getServiceNameFromGUID_Impl( GUID* ); -OUString getStorageTypeFromGUID_Impl( GUID* guid ); +wchar_t const * getStorageTypeFromGUID_Impl( GUID* guid ); #endif diff --git a/embedserv/source/embed/tracker.cxx b/embedserv/source/embed/tracker.cxx index cc10886d98d1..b39f5499d53f 100644 --- a/embedserv/source/embed/tracker.cxx +++ b/embedserv/source/embed/tracker.cxx @@ -19,6 +19,8 @@ #include +#include + #include #ifdef _MSC_VER @@ -540,7 +542,7 @@ void Tracker::DrawTrackerRect( // otherwise, size depends on the style if (m_nStyle & hatchedBorder) { - size.cx = size.cy = max(1,GetHandleSize(&rect)-1); + size.cx = size.cy = std::max(1,GetHandleSize(&rect)-1); InflateRect(&rect,size.cx,size.cy); } else @@ -698,7 +700,7 @@ int Tracker::GetHandleSize(LPRECT lpRect) const if (!(m_nStyle & resizeOutside)) { // make sure size is small enough for the size of the rect - int sizeMax = min(abs(rect->right - rect->left), + int sizeMax = std::min(abs(rect->right - rect->left), abs(rect->bottom - rect->top)); if (size * 2 > sizeMax) size = sizeMax / 2; diff --git a/embedserv/source/inc/stdafx.h b/embedserv/source/inc/stdafx.h index c056c5bf714a..8e65c0af9c4d 100644 --- a/embedserv/source/inc/stdafx.h +++ b/embedserv/source/inc/stdafx.h @@ -35,6 +35,12 @@ #endif #endif #include +#if defined max +#undef max +#endif +#if defined min +#undef min +#endif //You may derive a class from CComModule and use it if you want to override //something, but do not change the name of _Module extern CComModule _Module; -- cgit