Kaydet (Commit) 4deddf20 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

String to OUString.

Change-Id: I3a0eff8ca0c8b654a38ee2df1022ca162bcb67aa
üst 66f8bbc1
...@@ -379,7 +379,7 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream ) ...@@ -379,7 +379,7 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream )
{ {
try try
{ {
String aFilterName; OUString aFilterName;
if ( pFilter ) if ( pFilter )
aFilterName = pFilter->GetName(); aFilterName = pFilter->GetName();
aTypeName = SfxFilter::GetTypeFromStorage( xStorage, pFilter ? pFilter->IsOwnTemplateFormat() : false, &aFilterName ); aTypeName = SfxFilter::GetTypeFromStorage( xStorage, pFilter ? pFilter->IsOwnTemplateFormat() : false, &aFilterName );
......
...@@ -254,7 +254,7 @@ SdFilterDetect::~SdFilterDetect() ...@@ -254,7 +254,7 @@ SdFilterDetect::~SdFilterDetect()
// the storage can be corrupted and it will be detected here // the storage can be corrupted and it will be detected here
try try
{ {
String sFilterName; OUString sFilterName;
if ( pFilter ) if ( pFilter )
sFilterName = pFilter->GetName(); sFilterName = pFilter->GetName();
aTypeName = SfxFilter::GetTypeFromStorage( xStorage, pFilter ? pFilter->IsOwnTemplateFormat() : sal_False, &sFilterName ); aTypeName = SfxFilter::GetTypeFromStorage( xStorage, pFilter ? pFilter->IsOwnTemplateFormat() : sal_False, &sFilterName );
......
...@@ -101,13 +101,13 @@ public: ...@@ -101,13 +101,13 @@ public:
static const SfxFilter* GetFilterByName( const String& rName ); static const SfxFilter* GetFilterByName( const String& rName );
static const SfxFilter* GetDefaultFilterFromFactory( const String& rServiceName ); static const SfxFilter* GetDefaultFilterFromFactory( const String& rServiceName );
static String GetTypeFromStorage( const SotStorage& rStg ); static OUString GetTypeFromStorage( const SotStorage& rStg );
static String GetTypeFromStorage( const com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& xStorage, static OUString GetTypeFromStorage(
sal_Bool bTemplate = sal_False, const com::sun::star::uno::Reference<com::sun::star::embed::XStorage>& xStorage,
String* pName=0 ) bool bTemplate = false, OUString* pName = NULL )
throw ( ::com::sun::star::beans::UnknownPropertyException, throw ( com::sun::star::beans::UnknownPropertyException,
::com::sun::star::lang::WrappedTargetException, com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException ); com::sun::star::uno::RuntimeException );
}; };
#endif #endif
......
...@@ -2933,7 +2933,7 @@ SfxMedium::SfxMedium( const ::com::sun::star::uno::Sequence< ::com::sun::star::b ...@@ -2933,7 +2933,7 @@ SfxMedium::SfxMedium( const ::com::sun::star::uno::Sequence< ::com::sun::star::b
SfxMedium::SfxMedium( const uno::Reference < embed::XStorage >& rStor, const String& rBaseURL, const SfxItemSet* p ) : SfxMedium::SfxMedium( const uno::Reference < embed::XStorage >& rStor, const String& rBaseURL, const SfxItemSet* p ) :
pImp(new SfxMedium_Impl(this)) pImp(new SfxMedium_Impl(this))
{ {
String aType = SfxFilter::GetTypeFromStorage( rStor ); OUString aType = SfxFilter::GetTypeFromStorage(rStor);
pImp->m_pFilter = SFX_APP()->GetFilterMatcher().GetFilter4EA( aType ); pImp->m_pFilter = SFX_APP()->GetFilterMatcher().GetFilter4EA( aType );
DBG_ASSERT( pImp->m_pFilter, "No Filter for storage found!" ); DBG_ASSERT( pImp->m_pFilter, "No Filter for storage found!" );
......
...@@ -124,7 +124,7 @@ const SfxFilter* SfxFilter::GetFilterByName( const String& rName ) ...@@ -124,7 +124,7 @@ const SfxFilter* SfxFilter::GetFilterByName( const String& rName )
return aMatch.GetFilter4FilterName( rName, 0, 0 ); return aMatch.GetFilter4FilterName( rName, 0, 0 );
} }
String SfxFilter::GetTypeFromStorage( const SotStorage& rStg ) OUString SfxFilter::GetTypeFromStorage( const SotStorage& rStg )
{ {
const char* pType=0; const char* pType=0;
if ( rStg.IsStream( rtl::OUString("WordDocument") ) ) if ( rStg.IsStream( rtl::OUString("WordDocument") ) )
...@@ -164,26 +164,24 @@ String SfxFilter::GetTypeFromStorage( const SotStorage& rStg ) ...@@ -164,26 +164,24 @@ String SfxFilter::GetTypeFromStorage( const SotStorage& rStg )
return pType ? rtl::OUString::createFromAscii(pType) : rtl::OUString(); return pType ? rtl::OUString::createFromAscii(pType) : rtl::OUString();
} }
String SfxFilter::GetTypeFromStorage( const com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& xStorage, sal_Bool bTemplate, OUString SfxFilter::GetTypeFromStorage(
String* pFilterName ) const uno::Reference<embed::XStorage>& xStorage, bool bTemplate, OUString* pFilterName )
throw ( beans::UnknownPropertyException, throw ( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
lang::WrappedTargetException,
uno::RuntimeException )
{ {
SfxFilterMatcher aMatcher; SfxFilterMatcher aMatcher;
const char* pType=0; const char* pType=0;
String aName; OUString aName;
if ( pFilterName ) if ( pFilterName )
{ {
aName = *pFilterName; aName = *pFilterName;
pFilterName->Erase(); *pFilterName = OUString();
} }
com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xProps( xStorage, com::sun::star::uno::UNO_QUERY ); com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xProps( xStorage, com::sun::star::uno::UNO_QUERY );
if ( xProps.is() ) if ( xProps.is() )
{ {
::rtl::OUString aMediaType; OUString aMediaType;
xProps->getPropertyValue( ::rtl::OUString("MediaType") ) >>= aMediaType; xProps->getPropertyValue("MediaType") >>= aMediaType;
if ( !aMediaType.isEmpty() ) if ( !aMediaType.isEmpty() )
{ {
::com::sun::star::datatransfer::DataFlavor aDataFlavor; ::com::sun::star::datatransfer::DataFlavor aDataFlavor;
...@@ -200,7 +198,7 @@ String SfxFilter::GetTypeFromStorage( const com::sun::star::uno::Reference< com: ...@@ -200,7 +198,7 @@ String SfxFilter::GetTypeFromStorage( const com::sun::star::uno::Reference< com:
nDont |= SFX_FILTER_TEMPLATEPATH; nDont |= SFX_FILTER_TEMPLATEPATH;
const SfxFilter* pFilter = 0; const SfxFilter* pFilter = 0;
if ( aName.Len() ) if (!aName.isEmpty())
// get preselected Filter if it matches the desired filter flags // get preselected Filter if it matches the desired filter flags
pFilter = aMatcher.GetFilter4FilterName( aName, nMust, nDont ); pFilter = aMatcher.GetFilter4FilterName( aName, nMust, nDont );
...@@ -226,10 +224,10 @@ String SfxFilter::GetTypeFromStorage( const com::sun::star::uno::Reference< com: ...@@ -226,10 +224,10 @@ String SfxFilter::GetTypeFromStorage( const com::sun::star::uno::Reference< com:
//TODO: do it without SfxFilter //TODO: do it without SfxFilter
//TODO/LATER: don't yield FilterName, should be done in FWK! //TODO/LATER: don't yield FilterName, should be done in FWK!
String aRet; OUString aRet;
if ( pType ) if ( pType )
{ {
aRet = rtl::OUString::createFromAscii(pType); aRet = OUString::createFromAscii(pType);
if ( pFilterName ) if ( pFilterName )
*pFilterName = aMatcher.GetFilter4EA( aRet )->GetName(); *pFilterName = aMatcher.GetFilter4EA( aRet )->GetName();
} }
......
...@@ -224,7 +224,7 @@ SmFilterDetect::~SmFilterDetect() ...@@ -224,7 +224,7 @@ SmFilterDetect::~SmFilterDetect()
const SfxFilter* pFilter = aPreselectedFilterName.Len() ? const SfxFilter* pFilter = aPreselectedFilterName.Len() ?
SfxFilterMatcher().GetFilter4FilterName( aPreselectedFilterName ) : aTypeName.Len() ? SfxFilterMatcher().GetFilter4FilterName( aPreselectedFilterName ) : aTypeName.Len() ?
SfxFilterMatcher(rtl::OUString("smath")).GetFilter4EA( aTypeName ) : 0; SfxFilterMatcher(rtl::OUString("smath")).GetFilter4EA( aTypeName ) : 0;
String aTmpFilterName; OUString aTmpFilterName;
if ( pFilter ) if ( pFilter )
aTmpFilterName = pFilter->GetName(); aTmpFilterName = pFilter->GetName();
aTypeName = SfxFilter::GetTypeFromStorage( xStorage, pFilter ? pFilter->IsAllowedAsTemplate() : sal_False, &aTmpFilterName ); aTypeName = SfxFilter::GetTypeFromStorage( xStorage, pFilter ? pFilter->IsAllowedAsTemplate() : sal_False, &aTmpFilterName );
......
...@@ -231,7 +231,7 @@ SwFilterDetect::~SwFilterDetect() ...@@ -231,7 +231,7 @@ SwFilterDetect::~SwFilterDetect()
SfxFilterMatcher(rtl::OUString("swriter")).GetFilter4EA( aTypeName ) : 0; SfxFilterMatcher(rtl::OUString("swriter")).GetFilter4EA( aTypeName ) : 0;
if (!pPreFilter) if (!pPreFilter)
pPreFilter = SfxFilterMatcher(rtl::OUString("sweb")).GetFilter4EA( aTypeName ); pPreFilter = SfxFilterMatcher(rtl::OUString("sweb")).GetFilter4EA( aTypeName );
String aFilterName; OUString aFilterName;
if ( pPreFilter ) if ( pPreFilter )
{ {
aFilterName = pPreFilter->GetName(); aFilterName = pPreFilter->GetName();
......
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