summaryrefslogtreecommitdiff
path: root/sfx2/source/doc/DocumentMetadataAccess.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2/source/doc/DocumentMetadataAccess.cxx')
-rw-r--r--sfx2/source/doc/DocumentMetadataAccess.cxx234
1 files changed, 106 insertions, 128 deletions
diff --git a/sfx2/source/doc/DocumentMetadataAccess.cxx b/sfx2/source/doc/DocumentMetadataAccess.cxx
index 0ff55513c547..e2c407138069 100644
--- a/sfx2/source/doc/DocumentMetadataAccess.cxx
+++ b/sfx2/source/doc/DocumentMetadataAccess.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -43,7 +44,6 @@
#include <com/sun/star/rdf/URI.hpp>
#include <com/sun/star/rdf/Repository.hpp>
-#include <rtl/uuid.h>
#include <rtl/ustrbuf.hxx>
#include <rtl/uri.hxx>
#include <rtl/bootstrap.hxx>
@@ -97,7 +97,6 @@ bool isValidNCName(::rtl::OUString const & i_rIdref)
reinterpret_cast<const unsigned char*>(id.getStr()), 0));
}
-////////////////////////////////////////////////////////////////////////////
static const char s_content [] = "content.xml";
static const char s_styles [] = "styles.xml";
@@ -107,27 +106,25 @@ static const char s_manifest[] = "manifest.rdf";
static const char s_rdfxml [] = "application/rdf+xml";
static const char s_odfmime [] = "application/vnd.oasis.opendocument.";
-////////////////////////////////////////////////////////////////////////////
static bool isContentFile(::rtl::OUString const & i_rPath)
{
- return i_rPath.equalsAscii(s_content);
+ return i_rPath.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(s_content));
}
static bool isStylesFile (::rtl::OUString const & i_rPath)
{
- return i_rPath.equalsAscii(s_styles);
+ return i_rPath.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(s_styles));
}
static bool isReservedFile(::rtl::OUString const & i_rPath)
{
return isContentFile(i_rPath)
|| isStylesFile(i_rPath)
- || i_rPath.equalsAscii(s_meta)
- || i_rPath.equalsAscii(s_settings);
+ || i_rPath.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(s_meta))
+ || i_rPath.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(s_settings));
}
-////////////////////////////////////////////////////////////////////////////
uno::Reference<rdf::XURI> createBaseURI(
uno::Reference<uno::XComponentContext> const & i_xContext,
@@ -160,8 +157,8 @@ uno::Reference<rdf::XURI> createBaseURI(
i_xContext->getServiceManager(), uno::UNO_SET_THROW);
const uno::Reference<uri::XUriReferenceFactory> xUriFactory(
xServiceFactory->createInstanceWithContext(
- ::rtl::OUString::createFromAscii(
- "com.sun.star.uri.UriReferenceFactory"), i_xContext),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.uri.UriReferenceFactory")), i_xContext),
uno::UNO_QUERY_THROW);
uno::Reference< uri::XUriReference > xBaseURI;
@@ -174,17 +171,6 @@ uno::Reference<rdf::XURI> createBaseURI(
// if ( pkgURI.getLength() && ::utl::UCBContentHelper::IsFolder(pkgURI) )
if (true) {
xBaseURI.set( xPkgURI, uno::UNO_SET_THROW );
-#if 0
- } else {
- const uno::Reference<uri::XVndSunStarPkgUrlReferenceFactory>
- xPkgUriFactory( xServiceFactory->createInstanceWithContext(
- ::rtl::OUString::createFromAscii(
- "com.sun.star.uri.VndSunStarPkgUrlReferenceFactory"),
- i_xContext),
- uno::UNO_QUERY_THROW);
- xBaseURI.set( xPkgUriFactory->createVndSunStarPkgUrlReference(xPkgURI),
- uno::UNO_SET_THROW );
-#endif
}
::rtl::OUStringBuffer buf;
if (!xBaseURI->getUriReference().endsWithAsciiL("/", 1))
@@ -216,7 +202,6 @@ uno::Reference<rdf::XURI> createBaseURI(
return rdf::URI::create(i_xContext, xBaseURI->getUriReference());
}
-////////////////////////////////////////////////////////////////////////////
struct DocumentMetadataAccess_Impl
{
@@ -260,8 +245,8 @@ static bool isFileNameValid(const ::rtl::OUString & i_rFileName)
const ::rtl::OUString segment(
i_rFileName.getToken(0, static_cast<sal_Unicode> ('/'), idx) );
if (!segment.getLength() || // no empty segments
- segment.equalsAscii(".") || // no . segments
- segment.equalsAscii("..") || // no .. segments
+ segment.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(".")) || // no . segments
+ segment.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("..")) || // no .. segments
!::comphelper::OStorageHelper::IsValidZipEntryFileName(
segment, sal_False)) // no invalid characters
return false;
@@ -303,7 +288,6 @@ splitXmlId(::rtl::OUString const & i_XmlId,
}
}
-////////////////////////////////////////////////////////////////////////////
static uno::Reference<rdf::XURI>
getURIForStream(struct DocumentMetadataAccess_Impl& i_rImpl,
@@ -345,8 +329,8 @@ addFile(struct DocumentMetadataAccess_Impl & i_rImpl,
throw;
} catch (uno::Exception & e) {
throw lang::WrappedTargetRuntimeException(
- ::rtl::OUString::createFromAscii(
- "addFile: exception"), /*this*/0, uno::makeAny(e));
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "addFile: exception")), /*this*/0, uno::makeAny(e));
}
}
@@ -394,7 +378,7 @@ removeFile(struct DocumentMetadataAccess_Impl & i_rImpl,
throw;
} catch (uno::Exception & e) {
throw lang::WrappedTargetRuntimeException(
- ::rtl::OUString::createFromAscii("removeFile: exception"),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("removeFile: exception")),
0, uno::makeAny(e));
}
}
@@ -423,7 +407,7 @@ getAllParts(struct DocumentMetadataAccess_Impl & i_rImpl)
throw;
} catch (uno::Exception & e) {
throw lang::WrappedTargetRuntimeException(
- ::rtl::OUString::createFromAscii("getAllParts: exception"),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("getAllParts: exception")),
0, uno::makeAny(e));
}
}
@@ -445,12 +429,11 @@ isPartOfType(struct DocumentMetadataAccess_Impl & i_rImpl,
throw;
} catch (uno::Exception & e) {
throw lang::WrappedTargetRuntimeException(
- ::rtl::OUString::createFromAscii("isPartOfType: exception"),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("isPartOfType: exception")),
0, uno::makeAny(e));
}
}
-////////////////////////////////////////////////////////////////////////////
static ucb::InteractiveAugmentedIOException
mkException( ::rtl::OUString const & i_rMessage,
@@ -462,10 +445,10 @@ mkException( ::rtl::OUString const & i_rMessage,
iaioe.Classification = task::InteractionClassification_ERROR;
iaioe.Code = i_ErrorCode;
- const beans::PropertyValue uriProp(::rtl::OUString::createFromAscii("Uri"),
+ const beans::PropertyValue uriProp(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Uri")),
-1, uno::makeAny(i_rUri), static_cast<beans::PropertyState>(0));
const beans::PropertyValue rnProp(
- ::rtl::OUString::createFromAscii("ResourceName"),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ResourceName")),
-1, uno::makeAny(i_rResource), static_cast<beans::PropertyState>(0));
iaioe.Arguments = ::comphelper::makeSequence(
uno::makeAny(uriProp), uno::makeAny(rnProp));
@@ -485,8 +468,8 @@ handleError( ucb::InteractiveAugmentedIOException const & i_rException,
const uno::Reference<task::XInteractionHandler> & i_xHandler)
{
if (!i_xHandler.is()) {
- throw lang::WrappedTargetException(::rtl::OUString::createFromAscii(
- "DocumentMetadataAccess::loadMetadataFromStorage: exception"),
+ throw lang::WrappedTargetException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "DocumentMetadataAccess::loadMetadataFromStorage: exception")),
/* *this*/ 0, uno::makeAny(i_rException));
}
@@ -498,11 +481,7 @@ handleError( ucb::InteractiveAugmentedIOException const & i_rException,
new ::comphelper::OInteractionApprove );
::rtl::Reference< ::comphelper::OInteractionAbort > pAbort(
new ::comphelper::OInteractionAbort );
- /* this does not seem to work
- if (i_rException.Code != ucb::IOErrorCode_WRONG_FORMAT) {
- pRequest->addContinuation( pRetry.get() );
- }
- */
+
pRequest->addContinuation( pApprove.get() );
pRequest->addContinuation( pAbort.get() );
// actually call the handler
@@ -513,8 +492,8 @@ handleError( ucb::InteractiveAugmentedIOException const & i_rException,
return false;
} else {
OSL_ENSURE(pAbort->wasSelected(), "no continuation selected?");
- throw lang::WrappedTargetException(::rtl::OUString::createFromAscii(
- "DocumentMetadataAccess::loadMetadataFromStorage: exception"),
+ throw lang::WrappedTargetException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "DocumentMetadataAccess::loadMetadataFromStorage: exception")),
/* *this*/ 0, uno::makeAny(i_rException));
}
}
@@ -526,8 +505,8 @@ collectFilesFromStorage(uno::Reference<embed::XStorage> const& i_xStorage,
::rtl::OUString i_Path,
std::set< ::rtl::OUString > & o_rFiles)
{
- static ::rtl::OUString content(::rtl::OUString::createFromAscii(s_content));
- static ::rtl::OUString styles (::rtl::OUString::createFromAscii(s_styles ));
+ static ::rtl::OUString content(RTL_CONSTASCII_USTRINGPARAM(s_content));
+ static ::rtl::OUString styles(RTL_CONSTASCII_USTRINGPARAM(s_styles ));
try {
if (i_xStorage->hasByName(content) &&
i_xStorage->isStreamElement(content))
@@ -555,7 +534,7 @@ readStream(struct DocumentMetadataAccess_Impl & i_rImpl,
::rtl::OUString rest;
try {
if (!splitPath(i_rPath, dir, rest)) throw uno::RuntimeException();
- if (dir.equalsAscii("")) {
+ if (dir.getLength() == 0) {
if (i_xStorage->isStreamElement(i_rPath)) {
const uno::Reference<io::XStream> xStream(
i_xStorage->openStreamElement(i_rPath,
@@ -570,8 +549,8 @@ readStream(struct DocumentMetadataAccess_Impl & i_rImpl,
i_rImpl.m_xRepository->importGraph(rdf::FileFormat::RDF_XML,
xInStream, xURI, xBaseURI);
} else {
- throw mkException(::rtl::OUString::createFromAscii(
- "readStream: is not a stream"),
+ throw mkException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "readStream: is not a stream")),
ucb::IOErrorCode_NO_FILE, i_rBaseURI + i_rPath, i_rPath);
}
} else {
@@ -597,8 +576,8 @@ readStream(struct DocumentMetadataAccess_Impl & i_rImpl,
buf.append(dir).append(static_cast<sal_Unicode>('/'));
readStream(i_rImpl, xDir, rest, buf.makeStringAndClear() );
} else {
- throw mkException(::rtl::OUString::createFromAscii(
- "readStream: is not a directory"),
+ throw mkException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "readStream: is not a directory")),
ucb::IOErrorCode_NO_DIRECTORY, i_rBaseURI + dir, dir);
}
}
@@ -631,7 +610,7 @@ retry:
throw;
} catch (uno::Exception & e) {
throw lang::WrappedTargetRuntimeException(
- ::rtl::OUString::createFromAscii("importFile: exception"),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("importFile: exception")),
0, uno::makeAny(e));
}
}
@@ -652,8 +631,8 @@ exportStream(struct DocumentMetadataAccess_Impl & i_rImpl,
uno::UNO_QUERY);
if (xStreamProps.is()) { // this is NOT supported in FileSystemStorage
xStreamProps->setPropertyValue(
- ::rtl::OUString::createFromAscii("MediaType"),
- uno::makeAny(::rtl::OUString::createFromAscii(s_rdfxml)));
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")),
+ uno::makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s_rdfxml))));
}
const uno::Reference<io::XOutputStream> xOutStream(
xStream->getOutputStream(), uno::UNO_SET_THROW );
@@ -675,7 +654,7 @@ writeStream(struct DocumentMetadataAccess_Impl & i_rImpl,
::rtl::OUString rest;
if (!splitPath(i_rPath, dir, rest)) throw uno::RuntimeException();
try {
- if (dir.equalsAscii("")) {
+ if (dir.getLength() == 0) {
exportStream(i_rImpl, i_xStorage, i_xGraphName, i_rPath,
i_rBaseURI);
} else {
@@ -772,9 +751,9 @@ retry:
if (rterr.hasValue()) {
throw lang::WrappedTargetRuntimeException(
- ::rtl::OUString::createFromAscii(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"DocumentMetadataAccess::loadMetadataFromStorage: "
- "exception"), 0, rterr);
+ "exception")), 0, rterr);
}
if (err) {
@@ -798,7 +777,7 @@ static void init(struct DocumentMetadataAccess_Impl & i_rImpl)
getURI<rdf::URIs::PKG_DOCUMENT>(i_rImpl.m_xContext).get());
} catch (uno::Exception & e) {
throw lang::WrappedTargetRuntimeException(
- ::rtl::OUString::createFromAscii("init: unexpected exception"), 0,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("init: unexpected exception")), 0,
uno::makeAny(e));
}
@@ -814,7 +793,6 @@ static void init(struct DocumentMetadataAccess_Impl & i_rImpl)
}
-////////////////////////////////////////////////////////////////////////////
DocumentMetadataAccess::DocumentMetadataAccess(
uno::Reference< uno::XComponentContext > const & i_xContext,
@@ -849,7 +827,6 @@ DocumentMetadataAccess::~DocumentMetadataAccess()
{
}
-
// ::com::sun::star::rdf::XRepositorySupplier:
uno::Reference< rdf::XRepository > SAL_CALL
DocumentMetadataAccess::getRDFRepository() throw (uno::RuntimeException)
@@ -887,8 +864,8 @@ throw (uno::RuntimeException)
const IXmlIdRegistry * pReg(
m_pImpl->m_rXmlIdRegistrySupplier.GetXmlIdRegistry() );
if (!pReg) {
- throw uno::RuntimeException(::rtl::OUString::createFromAscii(
- "DocumentMetadataAccess::getElementByXmlId: no registry"), *this);
+ throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "DocumentMetadataAccess::getElementByXmlId: no registry")), *this);
}
return pReg->GetElementByMetadataReference(i_rReference);
}
@@ -899,8 +876,8 @@ DocumentMetadataAccess::getElementByURI(
throw (uno::RuntimeException, lang::IllegalArgumentException)
{
if (!i_xURI.is()) {
- throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
- "DocumentMetadataAccess::getElementByURI: URI is null"), *this, 0);
+ throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "DocumentMetadataAccess::getElementByURI: URI is null")), *this, 0);
}
const ::rtl::OUString baseURI( m_pImpl->m_xBaseURI->getStringValue() );
@@ -925,9 +902,9 @@ DocumentMetadataAccess::getMetadataGraphsWithType(
throw (uno::RuntimeException, lang::IllegalArgumentException)
{
if (!i_xType.is()) {
- throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"DocumentMetadataAccess::getMetadataGraphsWithType: "
- "type is null"), *this, 0);
+ "type is null")), *this, 0);
}
::comphelper::SequenceAsVector< uno::Reference< rdf::XURI > > ret;
@@ -948,21 +925,21 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
container::ElementExistException)
{
if (!isFileNameValid(i_rFileName)) {
- throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
- "DocumentMetadataAccess::addMetadataFile: invalid FileName"),
+ throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "DocumentMetadataAccess::addMetadataFile: invalid FileName")),
*this, 0);
}
if (isReservedFile(i_rFileName)) {
- throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"DocumentMetadataAccess::addMetadataFile:"
- "invalid FileName: reserved"), *this, 0);
+ "invalid FileName: reserved")), *this, 0);
}
for (sal_Int32 i = 0; i < i_rTypes.getLength(); ++i) {
if (!i_rTypes[i].is()) {
throw lang::IllegalArgumentException(
- ::rtl::OUString::createFromAscii(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"DocumentMetadataAccess::addMetadataFile: "
- "null type"), *this, 2);
+ "null type")), *this, 2);
}
}
@@ -973,8 +950,8 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
m_pImpl->m_xRepository->createGraph(xGraphName);
} catch (rdf::RepositoryException & e) {
throw lang::WrappedTargetRuntimeException(
- ::rtl::OUString::createFromAscii(
- "DocumentMetadataAccess::addMetadataFile: exception"),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "DocumentMetadataAccess::addMetadataFile: exception")),
*this, uno::makeAny(e));
// note: all other exceptions are propagated
}
@@ -994,20 +971,20 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
container::ElementExistException, rdf::ParseException, io::IOException)
{
if (!isFileNameValid(i_rFileName)) {
- throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
- "DocumentMetadataAccess::importMetadataFile: invalid FileName"),
+ throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "DocumentMetadataAccess::importMetadataFile: invalid FileName")),
*this, 0);
}
if (isReservedFile(i_rFileName)) {
- throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"DocumentMetadataAccess::importMetadataFile:"
- "invalid FileName: reserved"), *this, 0);
+ "invalid FileName: reserved")), *this, 0);
}
for (sal_Int32 i = 0; i < i_rTypes.getLength(); ++i) {
if (!i_rTypes[i].is()) {
throw lang::IllegalArgumentException(
- ::rtl::OUString::createFromAscii(
- "DocumentMetadataAccess::importMetadataFile: null type"),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "DocumentMetadataAccess::importMetadataFile: null type")),
*this, 5);
}
}
@@ -1020,9 +997,9 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
i_Format, i_xInStream, xGraphName, i_xBaseURI);
} catch (rdf::RepositoryException & e) {
throw lang::WrappedTargetRuntimeException(
- ::rtl::OUString::createFromAscii(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"DocumentMetadataAccess::importMetadataFile: "
- "RepositoryException"), *this, uno::makeAny(e));
+ "RepositoryException")), *this, uno::makeAny(e));
// note: all other exceptions are propagated
}
@@ -1041,9 +1018,9 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
m_pImpl->m_xRepository->destroyGraph(i_xGraphName);
} catch (rdf::RepositoryException & e) {
throw lang::WrappedTargetRuntimeException(
- ::rtl::OUString::createFromAscii(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"DocumentMetadataAccess::removeMetadataFile: "
- "RepositoryException"), *this, uno::makeAny(e));
+ "RepositoryException")), *this, uno::makeAny(e));
// note: all other exceptions are propagated
}
@@ -1058,15 +1035,15 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
container::ElementExistException)
{
if (!isFileNameValid(i_rFileName)) {
- throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"DocumentMetadataAccess::addContentOrStylesFile: "
- "invalid FileName"), *this, 0);
+ "invalid FileName")), *this, 0);
}
if (!addContentOrStylesFileImpl(*m_pImpl, i_rFileName)) {
- throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"DocumentMetadataAccess::addContentOrStylesFile: "
- "invalid FileName: must end with content.xml or styles.xml"),
+ "invalid FileName: must end with content.xml or styles.xml")),
*this, 0);
}
}
@@ -1078,9 +1055,9 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
container::NoSuchElementException)
{
if (!isFileNameValid(i_rFileName)) {
- throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"DocumentMetadataAccess::removeContentOrStylesFile: "
- "invalid FileName"), *this, 0);
+ "invalid FileName")), *this, 0);
}
try {
@@ -1093,9 +1070,9 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
uno::UNO_SET_THROW);
if (!xEnum->hasMoreElements()) {
throw container::NoSuchElementException(
- ::rtl::OUString::createFromAscii(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"DocumentMetadataAccess::removeContentOrStylesFile: "
- "cannot find stream in manifest graph: ") + i_rFileName,
+ "cannot find stream in manifest graph: ")) + i_rFileName,
*this);
}
@@ -1106,8 +1083,8 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
throw;
} catch (uno::Exception & e) {
throw lang::WrappedTargetRuntimeException(
- ::rtl::OUString::createFromAscii(
- "DocumentMetadataAccess::removeContentOrStylesFile: exception"),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "DocumentMetadataAccess::removeContentOrStylesFile: exception")),
*this, uno::makeAny(e));
}
}
@@ -1120,32 +1097,32 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
lang::WrappedTargetException)
{
if (!i_xStorage.is()) {
- throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"DocumentMetadataAccess::loadMetadataFromStorage: "
- "storage is null"), *this, 0);
+ "storage is null")), *this, 0);
}
if (!i_xBaseURI.is()) {
- throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"DocumentMetadataAccess::loadMetadataFromStorage: "
- "base URI is null"), *this, 1);
+ "base URI is null")), *this, 1);
}
const ::rtl::OUString baseURI( i_xBaseURI->getStringValue());
if (baseURI.indexOf('#') >= 0) {
- throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"DocumentMetadataAccess::loadMetadataFromStorage: "
- "base URI not absolute"), *this, 1);
+ "base URI not absolute")), *this, 1);
}
if (!baseURI.getLength() || !baseURI.endsWithAsciiL("/", 1)) {
- throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"DocumentMetadataAccess::loadMetadataFromStorage: "
- "base URI does not end with slash"), *this, 1);
+ "base URI does not end with slash")), *this, 1);
}
initLoading(*m_pImpl, i_xStorage, i_xBaseURI, i_xHandler);
std::set< ::rtl::OUString > StgFiles;
collectFilesFromStorage(i_xStorage,
- ::rtl::OUString::createFromAscii(""), StgFiles);
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")), StgFiles);
std::vector< ::rtl::OUString > MfstMetadataFiles;
@@ -1212,9 +1189,9 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
throw;
} catch (uno::Exception & e) {
throw lang::WrappedTargetRuntimeException(
- ::rtl::OUString::createFromAscii(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"DocumentMetadataAccess::loadMetadataFromStorage: "
- "exception"), *this, uno::makeAny(e));
+ "exception")), *this, uno::makeAny(e));
}
std::for_each(StgFiles.begin(), StgFiles.end(),
@@ -1231,9 +1208,9 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
lang::WrappedTargetException)
{
if (!i_xStorage.is()) {
- throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"DocumentMetadataAccess::storeMetadataToStorage: "
- "storage is null"), *this, 0);
+ "storage is null")), *this, 0);
}
// export manifest
@@ -1247,12 +1224,12 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
} catch (uno::RuntimeException &) {
throw;
} catch (io::IOException & e) {
- throw lang::WrappedTargetException( ::rtl::OUString::createFromAscii(
- "storeMetadataToStorage: IO exception"), *this, uno::makeAny(e));
+ throw lang::WrappedTargetException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "storeMetadataToStorage: IO exception")), *this, uno::makeAny(e));
} catch (uno::Exception & e) {
throw lang::WrappedTargetRuntimeException(
- ::rtl::OUString::createFromAscii(
- "storeMetadataToStorage: exception"), *this, uno::makeAny(e));
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "storeMetadataToStorage: exception")), *this, uno::makeAny(e));
}
// export metadata streams
@@ -1285,20 +1262,20 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
throw;
} catch (io::IOException & e) {
throw lang::WrappedTargetException(
- ::rtl::OUString::createFromAscii(
- "storeMetadataToStorage: IO exception"),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "storeMetadataToStorage: IO exception")),
*this, uno::makeAny(e));
} catch (uno::Exception & e) {
throw lang::WrappedTargetRuntimeException(
- ::rtl::OUString::createFromAscii(
- "storeMetadataToStorage: exception"),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "storeMetadataToStorage: exception")),
*this, uno::makeAny(e));
}
}
} catch (rdf::RepositoryException & e) {
throw lang::WrappedTargetRuntimeException(
- ::rtl::OUString::createFromAscii(
- "storeMetadataToStorage: exception"), *this, uno::makeAny(e));
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "storeMetadataToStorage: exception")), *this, uno::makeAny(e));
}
}
@@ -1317,10 +1294,10 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
if (md.addInputStream()) {
md[ ::comphelper::MediaDescriptor::PROP_INPUTSTREAM() ] >>= xIn;
}
- if (!xIn.is() && URL.equalsAscii("")) {
- throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ if (!xIn.is() && (URL.getLength() == 0)) {
+ throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"DocumentMetadataAccess::loadMetadataFromMedium: "
- "inalid medium: no URL, no input stream"), *this, 0);
+ "inalid medium: no URL, no input stream")), *this, 0);
}
uno::Reference<embed::XStorage> xStorage;
try {
@@ -1339,14 +1316,14 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
throw;
} catch (uno::Exception & e) {
throw lang::WrappedTargetException(
- ::rtl::OUString::createFromAscii(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"DocumentMetadataAccess::loadMetadataFromMedium: "
- "exception"), *this, uno::makeAny(e));
+ "exception")), *this, uno::makeAny(e));
}
if (!xStorage.is()) {
- throw uno::RuntimeException(::rtl::OUString::createFromAscii(
+ throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"DocumentMetadataAccess::loadMetadataFromMedium: "
- "cannot get Storage"), *this);
+ "cannot get Storage")), *this);
}
uno::Reference<rdf::XURI> xBaseURI;
try {
@@ -1356,7 +1333,7 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
try {
xBaseURI = createBaseURI(m_pImpl->m_xContext, xStorage, URL);
} catch (uno::Exception &) {
- OSL_ENSURE(false, "cannot create base URI");
+ OSL_FAIL("cannot create base URI");
}
}
uno::Reference<task::XInteractionHandler> xIH;
@@ -1373,10 +1350,10 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
::comphelper::MediaDescriptor md(i_rMedium);
::rtl::OUString URL;
md[ ::comphelper::MediaDescriptor::PROP_URL() ] >>= URL;
- if (URL.equalsAscii("")) {
- throw lang::IllegalArgumentException(::rtl::OUString::createFromAscii(
+ if (URL.getLength() == 0) {
+ throw lang::IllegalArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"DocumentMetadataAccess::storeMetadataToMedium: "
- "invalid medium: no URL"), *this, 0);
+ "invalid medium: no URL")), *this, 0);
}
SfxMedium aMedium(i_rMedium);
@@ -1393,9 +1370,9 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
}
if (!xStorage.is()) {
- throw uno::RuntimeException(::rtl::OUString::createFromAscii(
+ throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"DocumentMetadataAccess::storeMetadataToMedium: "
- "cannot get Storage"), *this);
+ "cannot get Storage")), *this);
}
// set MIME type of the storage
::comphelper::MediaDescriptor::const_iterator iter
@@ -1430,3 +1407,4 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
} // namespace sfx2
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */