Kaydet (Commit) 45c86d8a authored tarafından Ricardo Montania's avatar Ricardo Montania Kaydeden (comit) Olivier Hallot

More ::rtl::OUString to OUString and RTL_CONSTASCII in avmedia

Change-Id: I925862289cf5f9f41af5532bbbaf8ec0a4e5a66b
Reviewed-on: https://gerrit.libreoffice.org/610Reviewed-by: 's avatarOlivier Hallot <olivier.hallot@alta.org.br>
Tested-by: 's avatarOlivier Hallot <olivier.hallot@alta.org.br>
üst 9302520f
...@@ -59,8 +59,8 @@ TYPEINIT1_AUTOFACTORY( MediaItem, ::SfxPoolItem ); ...@@ -59,8 +59,8 @@ TYPEINIT1_AUTOFACTORY( MediaItem, ::SfxPoolItem );
struct MediaItem::Impl struct MediaItem::Impl
{ {
::rtl::OUString m_URL; OUString m_URL;
::rtl::OUString m_TempFileURL; OUString m_TempFileURL;
sal_uInt32 m_nMaskSet; sal_uInt32 m_nMaskSet;
MediaState m_eState; MediaState m_eState;
double m_fTime; double m_fTime;
...@@ -243,22 +243,22 @@ sal_uInt32 MediaItem::getMaskSet() const ...@@ -243,22 +243,22 @@ sal_uInt32 MediaItem::getMaskSet() const
//------------------------------------------------------------------------ //------------------------------------------------------------------------
void MediaItem::setURL( const ::rtl::OUString& rURL, void MediaItem::setURL( const OUString& rURL,
::rtl::OUString const*const pTempURL) OUString const*const pTempURL)
{ {
m_pImpl->m_URL = rURL; m_pImpl->m_URL = rURL;
m_pImpl->m_nMaskSet |= AVMEDIA_SETMASK_URL; m_pImpl->m_nMaskSet |= AVMEDIA_SETMASK_URL;
m_pImpl->m_TempFileURL = (pTempURL) ? *pTempURL : ::rtl::OUString(); m_pImpl->m_TempFileURL = (pTempURL) ? *pTempURL : OUString();
} }
//------------------------------------------------------------------------ //------------------------------------------------------------------------
const ::rtl::OUString& MediaItem::getURL() const const OUString& MediaItem::getURL() const
{ {
return m_pImpl->m_URL; return m_pImpl->m_URL;
} }
const ::rtl::OUString& MediaItem::getTempURL() const const OUString& MediaItem::getTempURL() const
{ {
return m_pImpl->m_TempFileURL; return m_pImpl->m_TempFileURL;
} }
...@@ -370,18 +370,17 @@ void MediaItem::setZoom( ::com::sun::star::media::ZoomLevel eZoom ) ...@@ -370,18 +370,17 @@ void MediaItem::setZoom( ::com::sun::star::media::ZoomLevel eZoom )
//------------------------------------------------------------------------ //------------------------------------------------------------------------
static ::rtl::OUString lcl_GetFilename(::rtl::OUString const& rSourceURL) static OUString lcl_GetFilename(OUString const& rSourceURL)
{ {
uno::Reference<uri::XUriReferenceFactory> const xUriFactory( uno::Reference<uri::XUriReferenceFactory> const xUriFactory(
::comphelper::createProcessComponent( ::comphelper::createProcessComponent(
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.uri.UriReferenceFactory"),
"com.sun.star.uri.UriReferenceFactory"))),
uno::UNO_QUERY_THROW); uno::UNO_QUERY_THROW);
uno::Reference<uri::XUriReference> const xSourceURI( uno::Reference<uri::XUriReference> const xSourceURI(
xUriFactory->parse(rSourceURL), uno::UNO_SET_THROW); xUriFactory->parse(rSourceURL), uno::UNO_SET_THROW);
::rtl::OUString filename; OUString filename;
{ {
sal_Int32 const nSegments(xSourceURI->getPathSegmentCount()); sal_Int32 const nSegments(xSourceURI->getPathSegmentCount());
if (0 < nSegments) if (0 < nSegments)
...@@ -392,21 +391,21 @@ static ::rtl::OUString lcl_GetFilename(::rtl::OUString const& rSourceURL) ...@@ -392,21 +391,21 @@ static ::rtl::OUString lcl_GetFilename(::rtl::OUString const& rSourceURL)
if (!::comphelper::OStorageHelper::IsValidZipEntryFileName( if (!::comphelper::OStorageHelper::IsValidZipEntryFileName(
filename, false) || !filename.getLength()) filename, false) || !filename.getLength())
{ {
filename = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("media")); filename = "media";
} }
return filename; return filename;
} }
static uno::Reference<io::XStream> static uno::Reference<io::XStream>
lcl_CreateStream(uno::Reference<embed::XStorage> const& xStorage, lcl_CreateStream(uno::Reference<embed::XStorage> const& xStorage,
::rtl::OUString const& rFilename) OUString const& rFilename)
{ {
::rtl::OUString filename(rFilename); OUString filename(rFilename);
if (xStorage->hasByName(filename)) if (xStorage->hasByName(filename))
{ {
::rtl::OUString basename; OUString basename;
::rtl::OUString suffix; OUString suffix;
sal_Int32 const nIndex(rFilename.lastIndexOf(sal_Unicode('.'))); sal_Int32 const nIndex(rFilename.lastIndexOf(sal_Unicode('.')));
if (0 < nIndex) if (0 < nIndex)
{ {
...@@ -417,7 +416,7 @@ lcl_CreateStream(uno::Reference<embed::XStorage> const& xStorage, ...@@ -417,7 +416,7 @@ lcl_CreateStream(uno::Reference<embed::XStorage> const& xStorage,
do do
{ {
++count; ++count;
filename = basename + ::rtl::OUString::valueOf(count) + suffix; filename = basename + OUString::valueOf(count) + suffix;
} }
while (xStorage->hasByName(filename)); while (xStorage->hasByName(filename));
} }
...@@ -429,21 +428,18 @@ lcl_CreateStream(uno::Reference<embed::XStorage> const& xStorage, ...@@ -429,21 +428,18 @@ lcl_CreateStream(uno::Reference<embed::XStorage> const& xStorage,
uno::Reference< beans::XPropertySet > const xStreamProps(xStream, uno::Reference< beans::XPropertySet > const xStreamProps(xStream,
uno::UNO_QUERY); uno::UNO_QUERY);
if (xStreamProps.is()) { // this is NOT supported in FileSystemStorage if (xStreamProps.is()) { // this is NOT supported in FileSystemStorage
xStreamProps->setPropertyValue( xStreamProps->setPropertyValue("MediaType", uno::makeAny(OUString(
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")),
uno::makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
//FIXME how to detect real media type? //FIXME how to detect real media type?
//but currently xmloff has this one hardcoded anyway... //but currently xmloff has this one hardcoded anyway...
"application/vnd.sun.star.media")))); "application/vnd.sun.star.media")));
xStreamProps->setPropertyValue( // turn off compression xStreamProps->setPropertyValue( // turn off compression
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Compressed")), "Compressed", uno::makeAny(sal_False));
uno::makeAny(sal_False));
} }
return xStream; return xStream;
} }
bool EmbedMedia(uno::Reference<frame::XModel> const& xModel, bool EmbedMedia(uno::Reference<frame::XModel> const& xModel,
::rtl::OUString const& rSourceURL, ::rtl::OUString & o_rEmbeddedURL) OUString const& rSourceURL, OUString & o_rEmbeddedURL)
{ {
try try
{ {
...@@ -455,11 +451,11 @@ bool EmbedMedia(uno::Reference<frame::XModel> const& xModel, ...@@ -455,11 +451,11 @@ bool EmbedMedia(uno::Reference<frame::XModel> const& xModel,
uno::Reference<embed::XStorage> const xStorage( uno::Reference<embed::XStorage> const xStorage(
xSBD->getDocumentStorage(), uno::UNO_QUERY_THROW); xSBD->getDocumentStorage(), uno::UNO_QUERY_THROW);
::rtl::OUString const media(RTL_CONSTASCII_USTRINGPARAM("Media")); OUString const media("Media");
uno::Reference<embed::XStorage> const xSubStorage( uno::Reference<embed::XStorage> const xSubStorage(
xStorage->openStorageElement(media, embed::ElementModes::WRITE)); xStorage->openStorageElement(media, embed::ElementModes::WRITE));
::rtl::OUString filename(lcl_GetFilename(rSourceURL)); OUString filename(lcl_GetFilename(rSourceURL));
uno::Reference<io::XStream> const xStream( uno::Reference<io::XStream> const xStream(
lcl_CreateStream(xSubStorage, filename), uno::UNO_SET_THROW); lcl_CreateStream(xSubStorage, filename), uno::UNO_SET_THROW);
...@@ -483,8 +479,7 @@ bool EmbedMedia(uno::Reference<frame::XModel> const& xModel, ...@@ -483,8 +479,7 @@ bool EmbedMedia(uno::Reference<frame::XModel> const& xModel,
xTransaction->commit(); xTransaction->commit();
} }
::rtl::OUStringBuffer buf(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( OUStringBuffer buf("vnd.sun.star.Package:");
"vnd.sun.star.Package:")));
buf.append(media); buf.append(media);
buf.append(sal_Unicode('/')); buf.append(sal_Unicode('/'));
buf.append(filename); buf.append(filename);
......
...@@ -132,7 +132,7 @@ void MediaFloater::ToggleFloatingMode() ...@@ -132,7 +132,7 @@ void MediaFloater::ToggleFloatingMode()
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void MediaFloater::setURL( const ::rtl::OUString& rURL, bool bPlayImmediately ) void MediaFloater::setURL( const OUString& rURL, bool bPlayImmediately )
{ {
if( mpMediaWindow ) if( mpMediaWindow )
{ {
...@@ -145,9 +145,9 @@ void MediaFloater::setURL( const ::rtl::OUString& rURL, bool bPlayImmediately ) ...@@ -145,9 +145,9 @@ void MediaFloater::setURL( const ::rtl::OUString& rURL, bool bPlayImmediately )
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
const ::rtl::OUString& MediaFloater::getURL() const const OUString& MediaFloater::getURL() const
{ {
static const ::rtl::OUString aEmptyStr; static const OUString aEmptyStr;
return( mpMediaWindow ? mpMediaWindow->getURL() : aEmptyStr ); return( mpMediaWindow ? mpMediaWindow->getURL() : aEmptyStr );
} }
......
...@@ -147,7 +147,7 @@ Window* MediaToolBoxControl::CreateItemWindow( Window *pParent ) ...@@ -147,7 +147,7 @@ Window* MediaToolBoxControl::CreateItemWindow( Window *pParent )
void MediaToolBoxControl::implUpdateMediaControl() void MediaToolBoxControl::implUpdateMediaControl()
{ {
updateStatus( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AVMediaToolBox" ) ) ); updateStatus( ".uno:AVMediaToolBox" );
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -160,10 +160,10 @@ void MediaToolBoxControl::implExecuteMediaControl( const MediaItem& rItem ) ...@@ -160,10 +160,10 @@ void MediaToolBoxControl::implExecuteMediaControl( const MediaItem& rItem )
aExecItem.merge( rItem ); aExecItem.merge( rItem );
aExecItem.QueryValue( aAny ); aExecItem.QueryValue( aAny );
aArgs[ 0 ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AVMediaToolBox" ) ); aArgs[ 0 ].Name = "AVMediaToolBox" ;
aArgs[ 0 ].Value = aAny; aArgs[ 0 ].Value = aAny;
Dispatch( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AVMediaToolBox" ) ), aArgs ); Dispatch( ".uno:AVMediaToolBox" , aArgs );
} }
} }
......
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