Kaydet (Commit) 6856da30 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

o3tl::string_view -> std::string_view (in embedserv)

Change-Id: I32bba8f45ff3b77084aa2d416126f96c051022f4
Reviewed-on: https://gerrit.libreoffice.org/66073
Tested-by: Jenkins
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst f0856d3c
......@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <sal/config.h>
#include <string_view>
#include <embeddoc.hxx>
#include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
......@@ -34,7 +38,6 @@
#include <comphelper/processfactory.hxx>
#include <o3tl/char16_t2wchar_t.hxx>
#include <o3tl/string_view.hxx>
#include <osl/mutex.hxx>
#include <osl/diagnose.h>
#include <sal/types.h>
......@@ -397,7 +400,7 @@ STDMETHODIMP EmbedDocument_Impl::InitNew( IStorage *pStg )
if ( m_xFactory.is() && pStg )
{
uno::Reference< frame::XModel > aDocument(
m_xFactory->createInstance( o3tl::toOUString(getServiceNameFromGUID_Impl( &m_guid )) ),
m_xFactory->createInstance( getServiceNameFromGUID_Impl( &m_guid ) ),
uno::UNO_QUERY );
if ( aDocument.is() )
{
......@@ -532,7 +535,7 @@ STDMETHODIMP EmbedDocument_Impl::Load( IStorage *pStg )
if ( xTempIn.is() )
{
uno::Reference< frame::XModel > aDocument(
m_xFactory->createInstance( o3tl::toOUString(getServiceNameFromGUID_Impl( &m_guid )) ),
m_xFactory->createInstance( getServiceNameFromGUID_Impl( &m_guid ) ),
uno::UNO_QUERY );
if ( aDocument.is() )
{
......@@ -739,7 +742,7 @@ STDMETHODIMP EmbedDocument_Impl::Load( LPCOLESTR pszFileName, DWORD /*dwMode*/ )
if ( FAILED( hr ) || !m_pMasterStorage ) return E_FAIL;
o3tl::u16string_view aCurType = getServiceNameFromGUID_Impl( &m_guid ); // ???
std::u16string_view aCurType = getServiceNameFromGUID_Impl( &m_guid ); // ???
CLIPFORMAT cf = static_cast<CLIPFORMAT>(RegisterClipboardFormatW( L"Embedded Object" ));
hr = WriteFmtUserTypeStg( m_pMasterStorage,
cf, // ???
......@@ -765,7 +768,7 @@ STDMETHODIMP EmbedDocument_Impl::Load( LPCOLESTR pszFileName, DWORD /*dwMode*/ )
uno::Reference< frame::XModel > aDocument(
m_xFactory->createInstance( o3tl::toOUString(getServiceNameFromGUID_Impl( &m_guid )) ),
m_xFactory->createInstance( getServiceNameFromGUID_Impl( &m_guid ) ),
uno::UNO_QUERY );
if ( aDocument.is() )
{
......
......@@ -58,7 +58,7 @@ wchar_t const * getStorageTypeFromGUID_Impl( GUID const * guid )
return L"";
}
o3tl::u16string_view getServiceNameFromGUID_Impl( GUID const * guid )
std::u16string_view getServiceNameFromGUID_Impl( GUID const * guid )
{
if ( *guid == OID_WriterTextServer )
return u"com.sun.star.comp.Writer.TextDocument";
......
......@@ -22,14 +22,15 @@
#include <sal/config.h>
#include <o3tl/string_view.hxx>
#include <string_view>
#include <rtl/ustring.hxx>
#include <common.h>
OUString getFilterNameFromGUID_Impl( GUID const * );
o3tl::u16string_view getServiceNameFromGUID_Impl( GUID const * );
std::u16string_view getServiceNameFromGUID_Impl( GUID const * );
wchar_t const * getStorageTypeFromGUID_Impl( GUID const * guid );
......
......@@ -24,6 +24,7 @@
#include <cassert>
#include <cstddef>
#include <limits>
#include <new>
#include <ostream>
#include <utility>
......@@ -410,6 +411,16 @@ public:
}
#endif
#if defined LIBO_INTERNAL_ONLY
OUString(std::u16string_view sv) {
if (sv.size() > sal_uInt32(std::numeric_limits<sal_Int32>::max())) {
throw std::bad_alloc();
}
pData = nullptr;
rtl_uString_newFromStr_WithLength(&pData, sv.data(), sv.size());
}
#endif
/**
Release the string data.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment