String=>OUString in svl's inettype and fall-out
Change-Id: I7d64d117183738b86d1869ed629d73675de9c679
This commit is contained in:
@@ -1001,7 +1001,7 @@ Reference<deployment::XPackage> PackageManagerImpl::getDeployedPackage_(
|
||||
{
|
||||
if (ignoreAlienPlatforms)
|
||||
{
|
||||
String type, subType;
|
||||
OUString type, subType;
|
||||
INetContentTypeParameterList params;
|
||||
if (INetContentTypes::parse( data.mediaType, type, subType, ¶ms ))
|
||||
{
|
||||
|
@@ -679,11 +679,11 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
|
||||
static_cast<OWeakObject *>(this), static_cast<sal_Int16>(-1) );
|
||||
}
|
||||
|
||||
String type, subType;
|
||||
OUString type, subType;
|
||||
INetContentTypeParameterList params;
|
||||
if (INetContentTypes::parse( mediaType, type, subType, ¶ms ))
|
||||
{
|
||||
if (type.EqualsIgnoreCaseAscii("application"))
|
||||
if (type.equalsIgnoreAsciiCaseAscii("application"))
|
||||
{
|
||||
OUString name;
|
||||
if (!bRemoved)
|
||||
@@ -692,7 +692,7 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
|
||||
name = StrTitle::getTitle( ucbContent );
|
||||
}
|
||||
|
||||
if (subType.EqualsIgnoreCaseAscii("vnd.sun.star.uno-component"))
|
||||
if (subType.equalsIgnoreAsciiCaseAscii("vnd.sun.star.uno-component"))
|
||||
{
|
||||
// xxx todo: probe and evaluate component xml description
|
||||
|
||||
@@ -738,8 +738,7 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (subType.EqualsIgnoreCaseAscii(
|
||||
"vnd.sun.star.uno-components"))
|
||||
else if (subType.equalsIgnoreAsciiCaseAscii("vnd.sun.star.uno-components"))
|
||||
{
|
||||
INetContentTypeParameter const * param = params.find(
|
||||
rtl::OString(RTL_CONSTASCII_STRINGPARAM("platform")));
|
||||
@@ -749,8 +748,7 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
|
||||
identifier);
|
||||
}
|
||||
}
|
||||
else if (subType.EqualsIgnoreCaseAscii(
|
||||
"vnd.sun.star.uno-typelibrary"))
|
||||
else if (subType.equalsIgnoreAsciiCaseAscii( "vnd.sun.star.uno-typelibrary"))
|
||||
{
|
||||
INetContentTypeParameter const * param = params.find(
|
||||
rtl::OString(RTL_CONSTASCII_STRINGPARAM("type")));
|
||||
|
@@ -330,11 +330,11 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
|
||||
static_cast<OWeakObject *>(this), static_cast<sal_Int16>(-1) );
|
||||
}
|
||||
|
||||
String type, subType;
|
||||
OUString type, subType;
|
||||
INetContentTypeParameterList params;
|
||||
if (INetContentTypes::parse( mediaType, type, subType, ¶ms ))
|
||||
{
|
||||
if (type.EqualsIgnoreCaseAscii("application"))
|
||||
if (type.equalsIgnoreAsciiCaseAscii("application"))
|
||||
{
|
||||
OUString name;
|
||||
if (!bRemoved)
|
||||
@@ -344,15 +344,13 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
|
||||
}
|
||||
|
||||
::ucbhelper::Content ucbContent( url, xCmdEnv, m_xComponentContext );
|
||||
if (subType.EqualsIgnoreCaseAscii(
|
||||
"vnd.sun.star.configuration-data"))
|
||||
if (subType.equalsIgnoreAsciiCaseAscii( "vnd.sun.star.configuration-data"))
|
||||
{
|
||||
return new PackageImpl(
|
||||
this, url, name, m_xConfDataTypeInfo, false /* data file */,
|
||||
bRemoved, identifier);
|
||||
}
|
||||
else if (subType.EqualsIgnoreCaseAscii(
|
||||
"vnd.sun.star.configuration-schema")) {
|
||||
else if (subType.equalsIgnoreAsciiCaseAscii( "vnd.sun.star.configuration-schema")) {
|
||||
return new PackageImpl(
|
||||
this, url, name, m_xConfSchemaTypeInfo, true /* schema file */,
|
||||
bRemoved, identifier);
|
||||
|
@@ -169,11 +169,11 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
|
||||
static_cast<OWeakObject *>(this), static_cast<sal_Int16>(-1) );
|
||||
}
|
||||
|
||||
String type, subType;
|
||||
OUString type, subType;
|
||||
INetContentTypeParameterList params;
|
||||
if (INetContentTypes::parse( mediaType, type, subType, ¶ms ))
|
||||
{
|
||||
if (type.EqualsIgnoreCaseAscii("application"))
|
||||
if (type.equalsIgnoreAsciiCaseAscii("application"))
|
||||
{
|
||||
OUString name;
|
||||
if (!bRemoved)
|
||||
@@ -182,7 +182,7 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
|
||||
url, xCmdEnv, getComponentContext() );
|
||||
name = StrTitle::getTitle( ucbContent );
|
||||
}
|
||||
if (subType.EqualsIgnoreCaseAscii("vnd.sun.star.executable"))
|
||||
if (subType.equalsIgnoreAsciiCaseAscii("vnd.sun.star.executable"))
|
||||
{
|
||||
return new BackendImpl::ExecutablePackageImpl(
|
||||
this, url, name, m_xExecutableTypeInfo, bRemoved,
|
||||
|
@@ -183,11 +183,11 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
|
||||
StrCannotDetectMediaType::get() + url,
|
||||
static_cast<OWeakObject *>(this), static_cast<sal_Int16>(-1) );
|
||||
|
||||
String type, subType;
|
||||
OUString type, subType;
|
||||
INetContentTypeParameterList params;
|
||||
if (INetContentTypes::parse( mediaType_, type, subType, ¶ms ))
|
||||
{
|
||||
if (type.EqualsIgnoreCaseAscii("application"))
|
||||
if (type.equalsIgnoreAsciiCaseAscii("application"))
|
||||
{
|
||||
OUString name;
|
||||
if (!bRemoved)
|
||||
@@ -197,8 +197,7 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
|
||||
name = StrTitle::getTitle( ucbContent );
|
||||
}
|
||||
|
||||
if (subType.EqualsIgnoreCaseAscii(
|
||||
"vnd.sun.star.help"))
|
||||
if (subType.equalsIgnoreAsciiCaseAscii( "vnd.sun.star.help"))
|
||||
{
|
||||
return new PackageImpl(
|
||||
this, url, name, m_xHelpTypeInfo, bRemoved,
|
||||
|
@@ -416,11 +416,11 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
|
||||
static_cast<OWeakObject *>(this), static_cast<sal_Int16>(-1) );
|
||||
}
|
||||
|
||||
String type, subType;
|
||||
OUString type, subType;
|
||||
INetContentTypeParameterList params;
|
||||
if (INetContentTypes::parse( mediaType, type, subType, ¶ms ))
|
||||
{
|
||||
if (type.EqualsIgnoreCaseAscii("application"))
|
||||
if (type.equalsIgnoreAsciiCaseAscii("application"))
|
||||
{
|
||||
|
||||
//In case a XPackage is created for a removed extension, we cannot
|
||||
@@ -432,13 +432,14 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
|
||||
url, xCmdEnv, getComponentContext() );
|
||||
name = StrTitle::getTitle( ucbContent );
|
||||
}
|
||||
if (subType.EqualsIgnoreCaseAscii("vnd.sun.star.package-bundle")) {
|
||||
if (subType.equalsIgnoreAsciiCaseAscii("vnd.sun.star.package-bundle"))
|
||||
{
|
||||
return new PackageImpl(
|
||||
this, url, name, m_xBundleTypeInfo, false, bRemoved,
|
||||
identifier);
|
||||
}
|
||||
else if (subType.EqualsIgnoreCaseAscii(
|
||||
"vnd.sun.star.legacy-package-bundle")) {
|
||||
else if (subType.equalsIgnoreAsciiCaseAscii( "vnd.sun.star.legacy-package-bundle"))
|
||||
{
|
||||
return new PackageImpl(
|
||||
this, url, name, m_xLegacyBundleTypeInfo, true, bRemoved,
|
||||
identifier);
|
||||
@@ -1311,17 +1312,15 @@ Sequence< Reference<deployment::XPackage> > BackendImpl::PackageImpl::getBundle(
|
||||
const Reference<deployment::XPackageTypeInfo> xPackageType(
|
||||
(*iPos)->getPackageType() );
|
||||
OSL_ASSERT( xPackageType.is() );
|
||||
if (xPackageType.is()) {
|
||||
if (xPackageType.is())
|
||||
{
|
||||
const OUString mediaType( xPackageType->getMediaType() );
|
||||
String type, subType;
|
||||
OUString type, subType;
|
||||
INetContentTypeParameterList params;
|
||||
if (INetContentTypes::parse(
|
||||
mediaType, type, subType, ¶ms ) &&
|
||||
type.EqualsIgnoreCaseAscii("application") &&
|
||||
(subType.EqualsIgnoreCaseAscii(
|
||||
"vnd.sun.star.uno-component") ||
|
||||
subType.EqualsIgnoreCaseAscii(
|
||||
"vnd.sun.star.configuration-data")))
|
||||
if (INetContentTypes::parse( mediaType, type, subType, ¶ms ) &&
|
||||
type.equalsIgnoreAsciiCaseAscii("application") &&
|
||||
(subType.equalsIgnoreAsciiCaseAscii( "vnd.sun.star.uno-component") ||
|
||||
subType.equalsIgnoreAsciiCaseAscii( "vnd.sun.star.configuration-data")))
|
||||
{
|
||||
--upper_end;
|
||||
pret[ upper_end ] = *iPos;
|
||||
@@ -1352,12 +1351,8 @@ inline bool isBundle_( OUString const & mediaType )
|
||||
{
|
||||
// xxx todo: additional parsing?
|
||||
return !mediaType.isEmpty() &&
|
||||
(mediaType.matchIgnoreAsciiCaseAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM(
|
||||
"application/vnd.sun.star.package-bundle") ) ||
|
||||
mediaType.matchIgnoreAsciiCaseAsciiL(
|
||||
RTL_CONSTASCII_STRINGPARAM(
|
||||
"application/vnd.sun.star.legacy-package-bundle") ));
|
||||
(mediaType.matchIgnoreAsciiCase( "application/vnd.sun.star.package-bundle") ||
|
||||
mediaType.matchIgnoreAsciiCase( "application/vnd.sun.star.legacy-package-bundle"));
|
||||
}
|
||||
|
||||
//______________________________________________________________________________
|
||||
@@ -1456,7 +1451,7 @@ void BackendImpl::PackageImpl::scanBundle(
|
||||
if ( fullPath.isEmpty() || mediaType.isEmpty() || mediaType == "text/xml" )// opt: exclude common text/xml
|
||||
continue;
|
||||
|
||||
String type, subType;
|
||||
OUString type, subType;
|
||||
INetContentTypeParameterList params;
|
||||
if (! INetContentTypes::parse( mediaType, type, subType, ¶ms ))
|
||||
continue;
|
||||
@@ -1468,9 +1463,8 @@ void BackendImpl::PackageImpl::scanBundle(
|
||||
const OUString url( makeURL( packageRootURL, fullPath ) );
|
||||
|
||||
// check for bundle description:
|
||||
if (type.EqualsIgnoreCaseAscii("application") &&
|
||||
subType.EqualsIgnoreCaseAscii(
|
||||
"vnd.sun.star.package-bundle-description"))
|
||||
if (type.equalsIgnoreAsciiCaseAscii("application") &&
|
||||
subType.equalsIgnoreAsciiCaseAscii( "vnd.sun.star.package-bundle-description"))
|
||||
{
|
||||
// check locale:
|
||||
param = params.find(rtl::OString(RTL_CONSTASCII_STRINGPARAM("locale")));
|
||||
|
@@ -245,11 +245,11 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
|
||||
static_cast<OWeakObject *>(this), static_cast<sal_Int16>(-1) );
|
||||
}
|
||||
|
||||
String type, subType;
|
||||
OUString type, subType;
|
||||
INetContentTypeParameterList params;
|
||||
if (INetContentTypes::parse( mediaType, type, subType, ¶ms ))
|
||||
{
|
||||
if (type.EqualsIgnoreCaseAscii("application"))
|
||||
if (type.equalsIgnoreAsciiCaseAscii("application"))
|
||||
{
|
||||
OUString dialogURL( makeURL( url, OUSTR("dialog.xlb") ) );
|
||||
if (! create_ucb_content(
|
||||
@@ -257,7 +257,7 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
|
||||
dialogURL = OUString();
|
||||
}
|
||||
|
||||
if (subType.EqualsIgnoreCaseAscii("vnd.sun.star.basic-library"))
|
||||
if (subType.equalsIgnoreAsciiCaseAscii("vnd.sun.star.basic-library"))
|
||||
{
|
||||
OUString scriptURL( makeURL( url, OUSTR("script.xlb")));
|
||||
if (! create_ucb_content(
|
||||
@@ -269,7 +269,7 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
|
||||
this, url, xCmdEnv, scriptURL,
|
||||
dialogURL, bRemoved, identifier);
|
||||
}
|
||||
else if (subType.EqualsIgnoreCaseAscii(
|
||||
else if (subType.equalsIgnoreAsciiCaseAscii(
|
||||
"vnd.sun.star.dialog-library")) {
|
||||
return new PackageImpl(
|
||||
this, url, xCmdEnv,
|
||||
|
@@ -219,13 +219,13 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
|
||||
static_cast<OWeakObject *>(this), static_cast<sal_Int16>(-1) );
|
||||
}
|
||||
|
||||
String type, subType;
|
||||
OUString type, subType;
|
||||
INetContentTypeParameterList params;
|
||||
if (INetContentTypes::parse( mediaType, type, subType, ¶ms ))
|
||||
{
|
||||
if (type.EqualsIgnoreCaseAscii("application"))
|
||||
if (type.equalsIgnoreAsciiCaseAscii("application"))
|
||||
{
|
||||
if (subType.EqualsIgnoreCaseAscii("vnd.sun.star.framework-script"))
|
||||
if (subType.equalsIgnoreAsciiCaseAscii("vnd.sun.star.framework-script"))
|
||||
{
|
||||
OUString lang = OUString("Script");
|
||||
OUString sParcelDescURL = makeURL(
|
||||
|
@@ -34,21 +34,15 @@
|
||||
#define CONTENT_TYPE_STR_APP_VND_CHART "application/vnd.stardivision.chart"
|
||||
#define CONTENT_TYPE_STR_APP_VND_DRAW "application/vnd.stardivision.draw"
|
||||
#define CONTENT_TYPE_STR_APP_VND_IMAGE "application/vnd.stardivision.image"
|
||||
#define CONTENT_TYPE_STR_APP_VND_IMPRESSPACKED \
|
||||
"application/vnd.stardivision.impress-packed"
|
||||
#define CONTENT_TYPE_STR_APP_VND_IMPRESS \
|
||||
"application/vnd.stardivision.impress"
|
||||
#define CONTENT_TYPE_STR_APP_VND_IMPRESSPACKED "application/vnd.stardivision.impress-packed"
|
||||
#define CONTENT_TYPE_STR_APP_VND_IMPRESS "application/vnd.stardivision.impress"
|
||||
#define CONTENT_TYPE_STR_APP_VND_MAIL "application/vnd.stardivision.mail"
|
||||
#define CONTENT_TYPE_STR_APP_VND_MATH "application/vnd.stardivision.math"
|
||||
#define CONTENT_TYPE_STR_APP_VND_NEWS "application/vnd.stardivision.news"
|
||||
#define CONTENT_TYPE_STR_APP_VND_OUTTRAY \
|
||||
"application/vnd.stardivision.outtray"
|
||||
#define CONTENT_TYPE_STR_APP_VND_TEMPLATE \
|
||||
"application/vnd.stardivision.template"
|
||||
#define CONTENT_TYPE_STR_APP_VND_WRITER_GLOBAL \
|
||||
"application/vnd.stardivision.writer-global"
|
||||
#define CONTENT_TYPE_STR_APP_VND_WRITER_WEB \
|
||||
"application/vnd.stardivision.writer-web"
|
||||
#define CONTENT_TYPE_STR_APP_VND_OUTTRAY "application/vnd.stardivision.outtray"
|
||||
#define CONTENT_TYPE_STR_APP_VND_TEMPLATE "application/vnd.stardivision.template"
|
||||
#define CONTENT_TYPE_STR_APP_VND_WRITER_GLOBAL "application/vnd.stardivision.writer-global"
|
||||
#define CONTENT_TYPE_STR_APP_VND_WRITER_WEB "application/vnd.stardivision.writer-web"
|
||||
#define CONTENT_TYPE_STR_APP_VND_WRITER "application/vnd.stardivision.writer"
|
||||
#define CONTENT_TYPE_STR_APP_FRAMESET "application/x-frameset"
|
||||
#define CONTENT_TYPE_STR_APP_GALLERY_THEME "application/x-gallery-theme"
|
||||
@@ -119,7 +113,6 @@
|
||||
#define CONTENT_TYPE_STR_APP_VND_SUN_XML_IMPRESS "application/vnd.sun.xml.impress"
|
||||
#define CONTENT_TYPE_STR_APP_VND_SUN_XML_DRAW "application/vnd.sun.xml.draw"
|
||||
#define CONTENT_TYPE_STR_APP_VND_SUN_XML_CHART "application/vnd.sun.xml.chart"
|
||||
|
||||
#define CONTENT_TYPE_STR_APP_VND_SUN_XML_MATH "application/vnd.sun.xml.math"
|
||||
#define CONTENT_TYPE_STR_APP_VND_SUN_XML_WRITER_GLOBAL "application/vnd.sun.xml.writer-global"
|
||||
#define CONTENT_TYPE_STR_APP_VND_SUN_XML_IMPRESSPACKED "application/vnd.sun.xml.impress-packed"
|
||||
@@ -256,28 +249,23 @@ enum INetContentType
|
||||
class SVL_DLLPUBLIC INetContentTypes
|
||||
{
|
||||
public:
|
||||
static INetContentType RegisterContentType(UniString const & rTypeName,
|
||||
UniString const &
|
||||
rPresentation,
|
||||
UniString const * pExtension
|
||||
= 0,
|
||||
UniString const *
|
||||
pSystemFileType = 0);
|
||||
static INetContentType RegisterContentType(OUString const & rTypeName,
|
||||
OUString const & rPresentation,
|
||||
OUString const * pExtension = 0,
|
||||
OUString const * pSystemFileType = 0);
|
||||
|
||||
static INetContentType GetContentType(UniString const & rTypeName);
|
||||
static INetContentType GetContentType(OUString const & rTypeName);
|
||||
|
||||
static rtl::OUString GetContentType(INetContentType eTypeID);
|
||||
|
||||
static UniString GetPresentation(INetContentType eTypeID,
|
||||
const ::com::sun::star::lang::Locale& aLocale);
|
||||
static OUString GetPresentation(INetContentType eTypeID,
|
||||
const ::com::sun::star::lang::Locale& aLocale);
|
||||
|
||||
static INetContentType GetContentType4Extension(UniString const &
|
||||
rExtension);
|
||||
static INetContentType GetContentType4Extension(OUString const & rExtension);
|
||||
|
||||
static INetContentType GetContentTypeFromURL(UniString const & rURL);
|
||||
static INetContentType GetContentTypeFromURL(OUString const & rURL);
|
||||
|
||||
static bool GetExtensionFromURL(UniString const & rURL,
|
||||
UniString & rExtension);
|
||||
static bool GetExtensionFromURL(OUString const & rURL, OUString & rExtension);
|
||||
|
||||
/** Parse the body of an RFC 2045 Content-Type header field.
|
||||
|
||||
@@ -306,8 +294,8 @@ public:
|
||||
@return True if the syntax of the field body is correct. If false is
|
||||
returned, none of the output parameters will be modified!
|
||||
*/
|
||||
static bool parse(UniString const & rMediaType, UniString & rType,
|
||||
UniString & rSubType,
|
||||
static bool parse(OUString const & rMediaType, OUString & rType,
|
||||
OUString & rSubType,
|
||||
INetContentTypeParameterList * pParameters = 0);
|
||||
};
|
||||
|
||||
|
@@ -40,15 +40,15 @@ struct MediaTypeEntry
|
||||
//============================================================================
|
||||
struct TypeIDMapEntry
|
||||
{
|
||||
UniString m_aTypeName;
|
||||
UniString m_aPresentation;
|
||||
UniString m_aSystemFileType;
|
||||
OUString m_aTypeName;
|
||||
OUString m_aPresentation;
|
||||
OUString m_aSystemFileType;
|
||||
};
|
||||
|
||||
//============================================================================
|
||||
struct TypeNameMapEntry
|
||||
{
|
||||
UniString m_aExtension;
|
||||
OUString m_aExtension;
|
||||
INetContentType m_eTypeID;
|
||||
|
||||
TypeNameMapEntry():
|
||||
@@ -67,8 +67,8 @@ struct ExtensionMapEntry
|
||||
//============================================================================
|
||||
class Registration
|
||||
{
|
||||
typedef boost::ptr_map<UniString, TypeNameMapEntry> TypeNameMap;
|
||||
typedef boost::ptr_map<UniString, ExtensionMapEntry> ExtensionMap;
|
||||
typedef boost::ptr_map<OUString, TypeNameMapEntry> TypeNameMap;
|
||||
typedef boost::ptr_map<OUString, ExtensionMapEntry> ExtensionMap;
|
||||
typedef std::map<INetContentType, TypeIDMapEntry*> TypeIDMap;
|
||||
|
||||
TypeIDMap m_aTypeIDMap; // map ContentType to TypeID
|
||||
@@ -83,23 +83,20 @@ public:
|
||||
public:
|
||||
static inline TypeIDMapEntry * getEntry(INetContentType eTypeID);
|
||||
|
||||
static TypeNameMapEntry * getExtensionEntry(UniString const & rTypeName);
|
||||
static TypeNameMapEntry * getExtensionEntry(OUString const & rTypeName);
|
||||
|
||||
static INetContentType RegisterContentType(UniString const & rTypeName,
|
||||
UniString const &
|
||||
rPresentation,
|
||||
UniString const * pExtension,
|
||||
UniString const *
|
||||
pSystemFileType);
|
||||
static INetContentType RegisterContentType(OUString const & rTypeName,
|
||||
OUString const & rPresentation,
|
||||
OUString const * pExtension,
|
||||
OUString const * pSystemFileType);
|
||||
|
||||
static INetContentType GetContentType(UniString const & rTypeName);
|
||||
static INetContentType GetContentType(OUString const & rTypeName);
|
||||
|
||||
static rtl::OUString GetContentType(INetContentType eTypeID);
|
||||
static OUString GetContentType(INetContentType eTypeID);
|
||||
|
||||
static UniString GetPresentation(INetContentType eTypeID);
|
||||
static OUString GetPresentation(INetContentType eTypeID);
|
||||
|
||||
static INetContentType GetContentType4Extension(UniString const &
|
||||
rExtension);
|
||||
static INetContentType GetContentType4Extension(OUString const & rExtension);
|
||||
|
||||
};
|
||||
|
||||
@@ -122,7 +119,7 @@ inline TypeIDMapEntry * Registration::getEntry(INetContentType eTypeID)
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
MediaTypeEntry const * seekEntry(UniString const & rTypeName,
|
||||
MediaTypeEntry const * seekEntry(OUString const & rTypeName,
|
||||
MediaTypeEntry const * pMap, sal_Size nSize);
|
||||
|
||||
//============================================================================
|
||||
@@ -522,11 +519,10 @@ Registration::~Registration()
|
||||
|
||||
//============================================================================
|
||||
// static
|
||||
TypeNameMapEntry * Registration::getExtensionEntry(UniString const &
|
||||
rTypeName)
|
||||
TypeNameMapEntry * Registration::getExtensionEntry(OUString const & rTypeName)
|
||||
{
|
||||
UniString aTheTypeName = rTypeName;
|
||||
aTheTypeName.ToLowerAscii();
|
||||
OUString aTheTypeName = rTypeName;
|
||||
aTheTypeName.toAsciiLowerCase();
|
||||
Registration &rRegistration = theRegistration::get();
|
||||
TypeNameMap::iterator it = rRegistration.m_aTypeNameMap.find(aTheTypeName);
|
||||
if (it != rRegistration.m_aTypeNameMap.end())
|
||||
@@ -536,23 +532,19 @@ TypeNameMapEntry * Registration::getExtensionEntry(UniString const &
|
||||
|
||||
//============================================================================
|
||||
// static
|
||||
INetContentType Registration::RegisterContentType(UniString const & rTypeName,
|
||||
UniString const &
|
||||
rPresentation,
|
||||
UniString const *
|
||||
pExtension,
|
||||
UniString const *
|
||||
pSystemFileType)
|
||||
INetContentType Registration::RegisterContentType(OUString const & rTypeName,
|
||||
OUString const & rPresentation,
|
||||
OUString const * pExtension,
|
||||
OUString const * pSystemFileType)
|
||||
{
|
||||
Registration &rRegistration = theRegistration::get();
|
||||
|
||||
DBG_ASSERT(GetContentType(rTypeName) == CONTENT_TYPE_UNKNOWN,
|
||||
"Registration::RegisterContentType(): Already registered");
|
||||
|
||||
INetContentType eTypeID
|
||||
= INetContentType(rRegistration.m_nNextDynamicID++);
|
||||
UniString aTheTypeName = rTypeName;
|
||||
aTheTypeName.ToLowerAscii();
|
||||
INetContentType eTypeID = INetContentType(rRegistration.m_nNextDynamicID++);
|
||||
OUString aTheTypeName = rTypeName;
|
||||
aTheTypeName.toAsciiLowerCase();
|
||||
|
||||
TypeIDMapEntry * pTypeIDMapEntry = new TypeIDMapEntry;
|
||||
pTypeIDMapEntry->m_aTypeName = aTheTypeName;
|
||||
@@ -579,12 +571,12 @@ INetContentType Registration::RegisterContentType(UniString const & rTypeName,
|
||||
|
||||
//============================================================================
|
||||
// static
|
||||
INetContentType Registration::GetContentType(UniString const & rTypeName)
|
||||
INetContentType Registration::GetContentType(OUString const & rTypeName)
|
||||
{
|
||||
Registration &rRegistration = theRegistration::get();
|
||||
|
||||
UniString aTheTypeName = rTypeName;
|
||||
aTheTypeName.ToLowerAscii();
|
||||
OUString aTheTypeName = rTypeName;
|
||||
aTheTypeName.toAsciiLowerCase();
|
||||
TypeNameMap::iterator it = rRegistration.m_aTypeNameMap.find(aTheTypeName);
|
||||
return it != rRegistration.m_aTypeNameMap.end()
|
||||
? it->second->m_eTypeID
|
||||
@@ -593,19 +585,19 @@ INetContentType Registration::GetContentType(UniString const & rTypeName)
|
||||
|
||||
//============================================================================
|
||||
// static
|
||||
rtl::OUString Registration::GetContentType(INetContentType eTypeID)
|
||||
OUString Registration::GetContentType(INetContentType eTypeID)
|
||||
{
|
||||
Registration &rRegistration = theRegistration::get();
|
||||
|
||||
TypeIDMap::iterator pEntry = rRegistration.m_aTypeIDMap.find( eTypeID );
|
||||
if( pEntry != rRegistration.m_aTypeIDMap.end() )
|
||||
return pEntry->second->m_aTypeName;
|
||||
return rtl::OUString();
|
||||
return OUString();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
// static
|
||||
UniString Registration::GetPresentation(INetContentType eTypeID)
|
||||
OUString Registration::GetPresentation(INetContentType eTypeID)
|
||||
{
|
||||
Registration &rRegistration = theRegistration::get();
|
||||
|
||||
@@ -613,13 +605,12 @@ UniString Registration::GetPresentation(INetContentType eTypeID)
|
||||
if( pEntry != rRegistration.m_aTypeIDMap.end() )
|
||||
return pEntry->second->m_aPresentation;
|
||||
else
|
||||
return UniString();
|
||||
return OUString();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
// static
|
||||
INetContentType Registration::GetContentType4Extension(UniString const &
|
||||
rExtension)
|
||||
INetContentType Registration::GetContentType4Extension(OUString const & rExtension)
|
||||
{
|
||||
Registration &rRegistration = theRegistration::get();
|
||||
|
||||
@@ -638,7 +629,7 @@ INetContentType Registration::GetContentType4Extension(UniString const &
|
||||
namespace
|
||||
{
|
||||
|
||||
MediaTypeEntry const * seekEntry(UniString const & rTypeName,
|
||||
MediaTypeEntry const * seekEntry(OUString const & rTypeName,
|
||||
MediaTypeEntry const * pMap, sal_Size nSize)
|
||||
{
|
||||
#if defined DBG_UTIL
|
||||
@@ -655,7 +646,7 @@ MediaTypeEntry const * seekEntry(UniString const & rTypeName,
|
||||
{
|
||||
sal_Size nMiddle = (nLow + nHigh) / 2;
|
||||
MediaTypeEntry const * pEntry = pMap + nMiddle;
|
||||
switch (rTypeName.CompareIgnoreCaseToAscii(pEntry->m_pTypeName))
|
||||
switch (rTypeName.compareToIgnoreAsciiCaseAscii(pEntry->m_pTypeName))
|
||||
{
|
||||
case COMPARE_LESS:
|
||||
nHigh = nMiddle;
|
||||
@@ -675,14 +666,10 @@ MediaTypeEntry const * seekEntry(UniString const & rTypeName,
|
||||
}
|
||||
|
||||
//static
|
||||
INetContentType INetContentTypes::RegisterContentType(UniString const &
|
||||
rTypeName,
|
||||
UniString const &
|
||||
rPresentation,
|
||||
UniString const *
|
||||
pExtension,
|
||||
UniString const *
|
||||
pSystemFileType)
|
||||
INetContentType INetContentTypes::RegisterContentType(OUString const & rTypeName,
|
||||
OUString const & rPresentation,
|
||||
OUString const * pExtension,
|
||||
OUString const * pSystemFileType)
|
||||
{
|
||||
INetContentType eTypeID = GetContentType(rTypeName);
|
||||
if (eTypeID == CONTENT_TYPE_UNKNOWN)
|
||||
@@ -694,15 +681,14 @@ INetContentType INetContentTypes::RegisterContentType(UniString const &
|
||||
TypeIDMapEntry * pTypeEntry = Registration::getEntry(eTypeID);
|
||||
if (pTypeEntry)
|
||||
{
|
||||
if (rPresentation.Len() != 0)
|
||||
if (!rPresentation.isEmpty())
|
||||
pTypeEntry->m_aPresentation = rPresentation;
|
||||
if (pSystemFileType)
|
||||
pTypeEntry->m_aSystemFileType = *pSystemFileType;
|
||||
}
|
||||
if (pExtension)
|
||||
{
|
||||
TypeNameMapEntry * pEntry
|
||||
= Registration::getExtensionEntry(rTypeName);
|
||||
TypeNameMapEntry * pEntry = Registration::getExtensionEntry(rTypeName);
|
||||
if (pEntry)
|
||||
pEntry->m_aExtension = *pExtension;
|
||||
}
|
||||
@@ -712,57 +698,53 @@ INetContentType INetContentTypes::RegisterContentType(UniString const &
|
||||
|
||||
//============================================================================
|
||||
// static
|
||||
INetContentType INetContentTypes::GetContentType(UniString const & rTypeName)
|
||||
INetContentType INetContentTypes::GetContentType(OUString const & rTypeName)
|
||||
{
|
||||
UniString aType;
|
||||
UniString aSubType;
|
||||
OUString aType;
|
||||
OUString aSubType;
|
||||
if (parse(rTypeName, aType, aSubType))
|
||||
{
|
||||
aType += '/';
|
||||
aType += "/";
|
||||
aType += aSubType;
|
||||
MediaTypeEntry const * pEntry = seekEntry(aType, aStaticTypeNameMap,
|
||||
CONTENT_TYPE_LAST + 1);
|
||||
return pEntry ? pEntry->m_eTypeID :
|
||||
Registration::GetContentType(aType);
|
||||
return pEntry ? pEntry->m_eTypeID : Registration::GetContentType(aType);
|
||||
}
|
||||
else
|
||||
return
|
||||
rTypeName.EqualsIgnoreCaseAscii(CONTENT_TYPE_STR_X_STARMAIL) ?
|
||||
CONTENT_TYPE_X_STARMAIL : CONTENT_TYPE_UNKNOWN;
|
||||
return rTypeName.equalsIgnoreAsciiCaseAscii(CONTENT_TYPE_STR_X_STARMAIL) ?
|
||||
CONTENT_TYPE_X_STARMAIL : CONTENT_TYPE_UNKNOWN;
|
||||
// the content type "x-starmail" has no sub type
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//static
|
||||
rtl::OUString INetContentTypes::GetContentType(INetContentType eTypeID)
|
||||
OUString INetContentTypes::GetContentType(INetContentType eTypeID)
|
||||
{
|
||||
static sal_Char const * aMap[CONTENT_TYPE_LAST + 1];
|
||||
static bool bInitialized = false;
|
||||
if (!bInitialized)
|
||||
{
|
||||
for (sal_Size i = 0; i <= CONTENT_TYPE_LAST; ++i)
|
||||
aMap[aStaticTypeNameMap[i].m_eTypeID]
|
||||
= aStaticTypeNameMap[i].m_pTypeName;
|
||||
aMap[aStaticTypeNameMap[i].m_eTypeID] = aStaticTypeNameMap[i].m_pTypeName;
|
||||
aMap[CONTENT_TYPE_UNKNOWN] = CONTENT_TYPE_STR_APP_OCTSTREAM;
|
||||
aMap[CONTENT_TYPE_TEXT_PLAIN] = CONTENT_TYPE_STR_TEXT_PLAIN
|
||||
"; charset=iso-8859-1";
|
||||
bInitialized = true;
|
||||
}
|
||||
|
||||
rtl::OUString aTypeName = eTypeID <= CONTENT_TYPE_LAST ?
|
||||
rtl::OUString::createFromAscii(aMap[eTypeID]) :
|
||||
Registration::GetContentType(eTypeID);
|
||||
OUString aTypeName = eTypeID <= CONTENT_TYPE_LAST ? OUString::createFromAscii(aMap[eTypeID])
|
||||
: Registration::GetContentType(eTypeID);
|
||||
if (aTypeName.isEmpty())
|
||||
{
|
||||
OSL_FAIL("INetContentTypes::GetContentType(): Bad ID");
|
||||
return rtl::OUString(CONTENT_TYPE_STR_APP_OCTSTREAM);
|
||||
return OUString(CONTENT_TYPE_STR_APP_OCTSTREAM);
|
||||
}
|
||||
return aTypeName;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//static
|
||||
UniString INetContentTypes::GetPresentation(INetContentType eTypeID,
|
||||
OUString INetContentTypes::GetPresentation(INetContentType eTypeID,
|
||||
const ::com::sun::star::lang::Locale& aLocale)
|
||||
{
|
||||
sal_uInt16 nResID = sal_uInt16();
|
||||
@@ -770,8 +752,8 @@ UniString INetContentTypes::GetPresentation(INetContentType eTypeID,
|
||||
nResID = aStaticResourceIDMap[eTypeID];
|
||||
else
|
||||
{
|
||||
UniString aPresentation = Registration::GetPresentation(eTypeID);
|
||||
if (aPresentation.Len() == 0)
|
||||
OUString aPresentation = Registration::GetPresentation(eTypeID);
|
||||
if (aPresentation.isEmpty())
|
||||
nResID = STR_SVT_MIMETYPE_APP_OCTSTREAM;
|
||||
else
|
||||
return aPresentation;
|
||||
@@ -781,38 +763,34 @@ UniString INetContentTypes::GetPresentation(INetContentType eTypeID,
|
||||
|
||||
//============================================================================
|
||||
//static
|
||||
INetContentType INetContentTypes::GetContentType4Extension(UniString const &
|
||||
rExtension)
|
||||
INetContentType INetContentTypes::GetContentType4Extension(OUString const & rExtension)
|
||||
{
|
||||
MediaTypeEntry const * pEntry = seekEntry(rExtension, aStaticExtensionMap,
|
||||
sizeof aStaticExtensionMap
|
||||
/ sizeof (MediaTypeEntry));
|
||||
sizeof aStaticExtensionMap / sizeof (MediaTypeEntry));
|
||||
if (pEntry)
|
||||
return pEntry->m_eTypeID;
|
||||
INetContentType eTypeID
|
||||
= Registration::GetContentType4Extension(rExtension);
|
||||
return eTypeID == CONTENT_TYPE_UNKNOWN ? CONTENT_TYPE_APP_OCTSTREAM :
|
||||
eTypeID;
|
||||
INetContentType eTypeID = Registration::GetContentType4Extension(rExtension);
|
||||
return eTypeID == CONTENT_TYPE_UNKNOWN ? CONTENT_TYPE_APP_OCTSTREAM
|
||||
: eTypeID;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//static
|
||||
INetContentType INetContentTypes::GetContentTypeFromURL(UniString const &
|
||||
rURL)
|
||||
INetContentType INetContentTypes::GetContentTypeFromURL(OUString const & rURL)
|
||||
{
|
||||
INetContentType eTypeID = CONTENT_TYPE_UNKNOWN;
|
||||
UniString aToken = rURL.GetToken(0, ':');
|
||||
if (aToken.Len() != 0)
|
||||
OUString aToken = rURL.getToken(0, ':');
|
||||
if (!aToken.isEmpty())
|
||||
{
|
||||
if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_FILE))
|
||||
if (rURL.GetChar(rURL.Len() - 1) == '/') // folder
|
||||
if (rURL.Len() > RTL_CONSTASCII_LENGTH("file:///"))
|
||||
if (aToken.equalsIgnoreAsciiCaseAscii(INETTYPE_URL_PROT_FILE))
|
||||
if (rURL[ rURL.getLength() - 1 ] == (sal_Unicode)'/') // folder
|
||||
if (rURL.getLength() > RTL_CONSTASCII_LENGTH("file:///"))
|
||||
if (WildCard("*/{*}/").Matches(rURL)) // special folder
|
||||
eTypeID = CONTENT_TYPE_X_CNT_FSYSSPECIALFOLDER;
|
||||
else
|
||||
// drive? -> "file:///?|/"
|
||||
if (rURL.Len() == 11
|
||||
&& rURL.GetChar(rURL.Len() - 2) == '|')
|
||||
if (rURL.getLength() == 11
|
||||
&& rURL[ rURL.getLength() - 2 ] == '|')
|
||||
{
|
||||
// Drives need further processing, because of
|
||||
// dynamic type according to underlying volume,
|
||||
@@ -826,72 +804,80 @@ INetContentType INetContentTypes::GetContentTypeFromURL(UniString const &
|
||||
{
|
||||
//@@@
|
||||
}
|
||||
else if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_HTTP)
|
||||
|| aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_HTTPS))
|
||||
else if (aToken.equalsIgnoreAsciiCaseAscii(INETTYPE_URL_PROT_HTTP)
|
||||
|| aToken.equalsIgnoreAsciiCaseAscii(INETTYPE_URL_PROT_HTTPS))
|
||||
eTypeID = CONTENT_TYPE_TEXT_HTML;
|
||||
else if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_PRIVATE))
|
||||
else if (aToken.equalsIgnoreAsciiCaseAscii(INETTYPE_URL_PROT_PRIVATE))
|
||||
{
|
||||
UniString aSecondPart = rURL.GetToken(1, ':');
|
||||
aToken = aSecondPart.GetToken(0, '/');
|
||||
if (aToken.EqualsAscii(INETTYPE_URL_SUB_FACTORY))
|
||||
OUString aSecondPart = rURL.getToken(1, ':');
|
||||
aToken = aSecondPart.getToken(0, '/');
|
||||
if (aToken.equalsAscii(INETTYPE_URL_SUB_FACTORY))
|
||||
{
|
||||
aToken = aSecondPart.GetToken(1, '/');
|
||||
if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SWRITER))
|
||||
aToken = aSecondPart.getToken(1, '/');
|
||||
if (aToken.equalsAscii(INETTYPE_URL_SSUB_SWRITER))
|
||||
{
|
||||
aToken = aSecondPart.GetToken(2, '/');
|
||||
eTypeID = aToken.EqualsAscii(INETTYPE_URL_SSSUB_WEB) ?
|
||||
aToken = aSecondPart.getToken(2, '/');
|
||||
eTypeID = aToken.equalsAscii(INETTYPE_URL_SSSUB_WEB) ?
|
||||
CONTENT_TYPE_APP_VND_WRITER_WEB :
|
||||
aToken.EqualsAscii(INETTYPE_URL_SSSUB_GLOB) ?
|
||||
aToken.equalsAscii(INETTYPE_URL_SSSUB_GLOB) ?
|
||||
CONTENT_TYPE_APP_VND_WRITER_GLOBAL :
|
||||
CONTENT_TYPE_APP_VND_WRITER;
|
||||
}
|
||||
else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SCALC))
|
||||
else if (aToken.equalsAscii(INETTYPE_URL_SSUB_SCALC))
|
||||
eTypeID = CONTENT_TYPE_APP_VND_CALC;
|
||||
else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SDRAW))
|
||||
else if (aToken.equalsAscii(INETTYPE_URL_SSUB_SDRAW))
|
||||
eTypeID = CONTENT_TYPE_APP_VND_DRAW;
|
||||
else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SIMPRESS))
|
||||
else if (aToken.equalsAscii(INETTYPE_URL_SSUB_SIMPRESS))
|
||||
eTypeID = CONTENT_TYPE_APP_VND_IMPRESS;
|
||||
else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SCHART))
|
||||
else if (aToken.equalsAscii(INETTYPE_URL_SSUB_SCHART))
|
||||
eTypeID = CONTENT_TYPE_APP_VND_CHART;
|
||||
else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SIMAGE))
|
||||
else if (aToken.equalsAscii(INETTYPE_URL_SSUB_SIMAGE))
|
||||
eTypeID = CONTENT_TYPE_APP_VND_IMAGE;
|
||||
else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SMATH))
|
||||
else if (aToken.equalsAscii(INETTYPE_URL_SSUB_SMATH))
|
||||
eTypeID = CONTENT_TYPE_APP_VND_MATH;
|
||||
else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_FRAMESET))
|
||||
else if (aToken.equalsAscii(INETTYPE_URL_SSUB_FRAMESET))
|
||||
eTypeID = CONTENT_TYPE_APP_FRAMESET;
|
||||
}
|
||||
else if (aToken.EqualsAscii(INETTYPE_URL_SUB_HELPID))
|
||||
else if (aToken.equalsAscii(INETTYPE_URL_SUB_HELPID))
|
||||
eTypeID = CONTENT_TYPE_APP_STARHELP;
|
||||
}
|
||||
else if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_COMPONENT))
|
||||
else if (aToken.equalsIgnoreAsciiCaseAscii(INETTYPE_URL_PROT_COMPONENT))
|
||||
{
|
||||
aToken = rURL.GetToken(1, ':'); // aToken now equals ss / *
|
||||
aToken = aToken.GetToken(0, '/');
|
||||
if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SS))
|
||||
eTypeID = rURL.SearchAscii(INETTYPE_URL_SCHED_CMB)
|
||||
== STRING_NOTFOUND
|
||||
&& rURL.SearchAscii(INETTYPE_URL_SCHED_FORM)
|
||||
== STRING_NOTFOUND ?
|
||||
CONTENT_TYPE_APP_SCHEDULE :
|
||||
rURL.SearchAscii(INETTYPE_URL_SCHED_TASK)
|
||||
== STRING_NOTFOUND ?
|
||||
CONTENT_TYPE_APP_SCHEDULE_EVT :
|
||||
CONTENT_TYPE_APP_SCHEDULE_TASK;
|
||||
aToken = rURL.getToken(1, ':'); // aToken now equals ss / *
|
||||
aToken = aToken.getToken(0, '/');
|
||||
if (aToken.equalsAscii(INETTYPE_URL_SSUB_SS))
|
||||
{
|
||||
if(rURL.indexOf(INETTYPE_URL_SCHED_CMB) < 0 && rURL.indexOf(INETTYPE_URL_SCHED_FORM) < 0)
|
||||
{
|
||||
eTypeID = CONTENT_TYPE_APP_SCHEDULE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( rURL.indexOf(INETTYPE_URL_SCHED_TASK) < 0)
|
||||
{
|
||||
eTypeID = CONTENT_TYPE_APP_SCHEDULE_EVT;
|
||||
}
|
||||
else
|
||||
{
|
||||
eTypeID = CONTENT_TYPE_APP_SCHEDULE_TASK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_MAILTO))
|
||||
else if (aToken.equalsIgnoreAsciiCaseAscii(INETTYPE_URL_PROT_MAILTO))
|
||||
eTypeID = CONTENT_TYPE_APP_VND_OUTTRAY;
|
||||
else if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_MACRO))
|
||||
else if (aToken.equalsIgnoreAsciiCaseAscii(INETTYPE_URL_PROT_MACRO))
|
||||
eTypeID = CONTENT_TYPE_APP_MACRO;
|
||||
else if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_DATA))
|
||||
else if (aToken.equalsIgnoreAsciiCaseAscii(INETTYPE_URL_PROT_DATA))
|
||||
{
|
||||
UniString aSecondPart = rURL.GetToken(1, ':');
|
||||
aToken = aSecondPart.GetToken(0, ',');
|
||||
OUString aSecondPart = rURL.getToken(1, ':');
|
||||
aToken = aSecondPart.getToken(0, ',');
|
||||
eTypeID = GetContentType(aToken);
|
||||
}
|
||||
}
|
||||
if (eTypeID == CONTENT_TYPE_UNKNOWN)
|
||||
{
|
||||
UniString aExtension;
|
||||
OUString aExtension;
|
||||
if (GetExtensionFromURL(rURL, aExtension))
|
||||
eTypeID = GetContentType4Extension(aExtension);
|
||||
}
|
||||
@@ -900,26 +886,26 @@ INetContentType INetContentTypes::GetContentTypeFromURL(UniString const &
|
||||
|
||||
//============================================================================
|
||||
//static
|
||||
bool INetContentTypes::GetExtensionFromURL(UniString const & rURL,
|
||||
UniString & rExtension)
|
||||
bool INetContentTypes::GetExtensionFromURL(OUString const & rURL,
|
||||
OUString & rExtension)
|
||||
{
|
||||
xub_StrLen nSlashPos = 0;
|
||||
xub_StrLen i = 0;
|
||||
while (i != STRING_NOTFOUND)
|
||||
sal_Int32 nSlashPos = 0;
|
||||
sal_Int32 i = 0;
|
||||
while (i >= 0)
|
||||
{
|
||||
nSlashPos = i;
|
||||
i = rURL.Search('/', i + 1);
|
||||
i = rURL.indexOf((sal_Unicode)'/', i + 1);
|
||||
}
|
||||
if (nSlashPos != 0)
|
||||
{
|
||||
xub_StrLen nLastDotPos = i = rURL.Search('.', nSlashPos);
|
||||
while (i != STRING_NOTFOUND)
|
||||
sal_Int32 nLastDotPos = i = rURL.indexOf((sal_Unicode)'.', nSlashPos);
|
||||
while (i >= 0)
|
||||
{
|
||||
nLastDotPos = i;
|
||||
i = rURL.Search('.', i + 1);
|
||||
i = rURL.indexOf((sal_Unicode)'.', i + 1);
|
||||
}
|
||||
if (nLastDotPos != STRING_NOTFOUND)
|
||||
rExtension = rURL.Copy(nLastDotPos + 1);
|
||||
if (nLastDotPos >- 0)
|
||||
rExtension = rURL.copy(nLastDotPos + 1);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -927,12 +913,12 @@ bool INetContentTypes::GetExtensionFromURL(UniString const & rURL,
|
||||
|
||||
//============================================================================
|
||||
// static
|
||||
bool INetContentTypes::parse(UniString const & rMediaType,
|
||||
UniString & rType, UniString & rSubType,
|
||||
bool INetContentTypes::parse(OUString const & rMediaType,
|
||||
OUString & rType, OUString & rSubType,
|
||||
INetContentTypeParameterList * pParameters)
|
||||
{
|
||||
sal_Unicode const * p = rMediaType.GetBuffer();
|
||||
sal_Unicode const * pEnd = p + rMediaType.Len();
|
||||
sal_Unicode const * p = rMediaType.getStr();
|
||||
sal_Unicode const * pEnd = p + rMediaType.getLength();
|
||||
|
||||
p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd);
|
||||
sal_Unicode const * pToken = p;
|
||||
@@ -944,9 +930,9 @@ bool INetContentTypes::parse(UniString const & rMediaType,
|
||||
}
|
||||
if (p == pToken)
|
||||
return false;
|
||||
rType = rtl::OUString(pToken, p - pToken);
|
||||
rType = OUString(pToken, p - pToken);
|
||||
if (bDowncase)
|
||||
rType.ToLowerAscii();
|
||||
rType.toAsciiLowerCase();
|
||||
|
||||
p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd);
|
||||
if (p == pEnd || *p++ != '/')
|
||||
@@ -962,9 +948,9 @@ bool INetContentTypes::parse(UniString const & rMediaType,
|
||||
}
|
||||
if (p == pToken)
|
||||
return false;
|
||||
rSubType = rtl::OUString(pToken, p - pToken);
|
||||
rSubType = OUString(pToken, p - pToken);
|
||||
if (bDowncase)
|
||||
rSubType.ToLowerAscii();
|
||||
rSubType.toAsciiLowerCase();
|
||||
|
||||
return INetMIME::scanParameters(p, pEnd, pParameters) == pEnd;
|
||||
}
|
||||
|
@@ -91,11 +91,14 @@ void ODocumentInfoPreview::fill(
|
||||
insertNonempty(
|
||||
DI_SIZE, CreateExactSizeText(utl::UCBContentHelper::GetSize(rURL)));
|
||||
INetContentType eTypeID = INetContentTypes::GetContentTypeFromURL(rURL);
|
||||
insertNonempty(
|
||||
DI_MIMETYPE,
|
||||
(eTypeID == CONTENT_TYPE_APP_OCTSTREAM
|
||||
? SvFileInformationManager::GetDescription(INetURLObject(rURL))
|
||||
: INetContentTypes::GetPresentation(eTypeID, m_aLocale)));
|
||||
if(eTypeID == CONTENT_TYPE_APP_OCTSTREAM)
|
||||
{
|
||||
insertNonempty( DI_MIMETYPE, SvFileInformationManager::GetDescription(INetURLObject(rURL)));
|
||||
}
|
||||
else
|
||||
{
|
||||
insertNonempty( DI_MIMETYPE, INetContentTypes::GetPresentation(eTypeID, m_aLocale));
|
||||
}
|
||||
}
|
||||
|
||||
// User-defined (custom) properties:
|
||||
|
@@ -2247,19 +2247,16 @@ bool HTMLParser::ParseMetaOptions(
|
||||
|
||||
rtl_TextEncoding HTMLParser::GetEncodingByMIME( const String& rMime )
|
||||
{
|
||||
String sType;
|
||||
String sSubType;
|
||||
OUString sType;
|
||||
OUString sSubType;
|
||||
INetContentTypeParameterList aParameters;
|
||||
if (INetContentTypes::parse(rMime, sType, sSubType, &aParameters))
|
||||
{
|
||||
const INetContentTypeParameter * pCharset
|
||||
= aParameters.find("charset");
|
||||
const INetContentTypeParameter * pCharset = aParameters.find("charset");
|
||||
if (pCharset != 0)
|
||||
{
|
||||
rtl::OString sValue(rtl::OUStringToOString(pCharset->m_sValue,
|
||||
RTL_TEXTENCODING_ASCII_US));
|
||||
return GetExtendedCompatibilityTextEncoding(
|
||||
rtl_getTextEncodingFromMimeCharset( sValue.getStr() ) );
|
||||
OString sValue(rtl::OUStringToOString(pCharset->m_sValue, RTL_TEXTENCODING_ASCII_US));
|
||||
return GetExtendedCompatibilityTextEncoding( rtl_getTextEncodingFromMimeCharset( sValue.getStr() ) );
|
||||
}
|
||||
}
|
||||
return RTL_TEXTENCODING_DONTKNOW;
|
||||
|
Reference in New Issue
Block a user