diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-04-10 10:16:11 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-04-10 10:16:11 +0200 |
commit | bad606febb291022140cb4fb637005cfafff6f98 (patch) | |
tree | a259f96555aec035ac5a76a980ad3e307ff662b9 | |
parent | cf59d64ae2f9321845af669678370d68c52b7985 (diff) |
Clean up uses of SAL_U/SAL_W: embedserv
Change-Id: I5a73acf6ccfc1709e95e55fa15c32ec6dda2657a
-rw-r--r-- | embedserv/source/embed/ed_ioleobject.cxx | 9 | ||||
-rw-r--r-- | embedserv/source/embed/ed_ipersiststr.cxx | 17 | ||||
-rw-r--r-- | embedserv/source/embed/guid.cxx | 48 | ||||
-rw-r--r-- | embedserv/source/embed/guid.hxx | 5 | ||||
-rw-r--r-- | embedserv/source/embed/tracker.cxx | 6 | ||||
-rw-r--r-- | embedserv/source/inc/stdafx.h | 6 | ||||
-rw-r--r-- | include/o3tl/string_view.hxx | 11 |
7 files changed, 61 insertions, 41 deletions
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<sal_Unicode const *>(szContainerObj))); m_pDocHolder->setContainerName( - OUString( - SAL_U(szContainerApp))); + OUString(reinterpret_cast<sal_Unicode const *>(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<LPCOLESTR>(nullptr), FALSE ); // triggers saving to the link location - SaveCompleted( SAL_W(aPreservFileName.getStr()) ); + SaveCompleted( + reinterpret_cast<wchar_t const *>(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 <com/sun/star/util/XURLTransformer.hpp> #include <comphelper/processfactory.hxx> +#include <o3tl/string_view.hxx> #include <osl/mutex.hxx> #include <osl/diagnose.h> #include <sal/types.h> @@ -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<sal_Unicode *>(aCurType.getStr())) ); + const_cast<wchar_t *>(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<sal_Unicode *>(aCurType.getStr())) ); + const_cast<wchar_t *>(reinterpret_cast<wchar_t const *>(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<sal_Unicode *>(aCurType.getStr())) ); + const_cast<wchar_t *>(reinterpret_cast<wchar_t const *>(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 <guid.hxx> -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 <sal/config.h> +#include <o3tl/string_view.hxx> #include <rtl/ustring.hxx> #include <common.h> 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 <sal/config.h> +#include <algorithm> + #include <sal/types.h> #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 <atlbase.h> +#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; diff --git a/include/o3tl/string_view.hxx b/include/o3tl/string_view.hxx index 9230909b7edf..ae284b20173d 100644 --- a/include/o3tl/string_view.hxx +++ b/include/o3tl/string_view.hxx @@ -862,6 +862,17 @@ template<> struct hash<o3tl::wstring_view> { } +namespace o3tl { + +// LO-specific convenience functions: + +// For std::u16string_view, this will be provided by a (LIBO_INTERNAL_ONLY) +// rtl::OUString constructor: +inline OUString toOUString(u16string_view s) +{ return OUString(s.data(), s.size()); } + +} + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |