LibreOffice Module sfx2 (master) 1
Classes | Namespaces | Functions | Variables
DocumentMetadataAccess.cxx File Reference
#include <sfx2/DocumentMetadataAccess.hxx>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/frame/XTransientDocumentsDocumentContentIdentifierFactory.hpp>
#include <com/sun/star/task/ErrorCodeIOException.hpp>
#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
#include <com/sun/star/rdf/FileFormat.hpp>
#include <com/sun/star/rdf/ParseException.hpp>
#include <com/sun/star/rdf/RepositoryException.hpp>
#include <com/sun/star/rdf/URIs.hpp>
#include <com/sun/star/rdf/Statement.hpp>
#include <com/sun/star/rdf/URI.hpp>
#include <com/sun/star/rdf/Repository.hpp>
#include <rtl/ustrbuf.hxx>
#include <rtl/uri.hxx>
#include <rtl/bootstrap.hxx>
#include <sal/log.hxx>
#include <comphelper/interaction.hxx>
#include <unotools/mediadescriptor.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/storagehelper.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <o3tl/string_view.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/XmlIdRegistry.hxx>
#include <sfx2/objsh.hxx>
#include <comphelper/diagnose_ex.hxx>
#include <libxml/tree.h>
#include <utility>
#include <vector>
#include <set>
#include <string_view>
#include <com/sun/star/uri/XUriReference.hpp>
#include <com/sun/star/uri/UriReferenceFactory.hpp>
Include dependency graph for DocumentMetadataAccess.cxx:

Go to the source code of this file.

Classes

struct  sfx2::DocumentMetadataAccess_Impl
 

Namespaces

namespace  sfx2
 

Functions

bool sfx2::isValidNCName (std::u16string_view i_rIdref)
 is i_rIdref a valid NCName ? More...
 
static bool sfx2::isContentFile (std::u16string_view i_rPath)
 
static bool sfx2::isStylesFile (std::u16string_view i_rPath)
 
bool sfx2::isValidXmlId (std::u16string_view i_rStreamName, std::u16string_view i_rIdref)
 
static bool sfx2::isReservedFile (std::u16string_view i_rPath)
 
uno::Reference< rdf::XURI > sfx2::createBaseURI (uno::Reference< uno::XComponentContext > const &i_xContext, uno::Reference< frame::XModel > const &i_xModel, OUString const &i_rPkgURI, std::u16string_view i_rSubDocument)
 
template<sal_Int16 Constant>
static uno::Reference< rdf::XURI > const & sfx2::getURI (uno::Reference< uno::XComponentContext > const &i_xContext)
 
static bool sfx2::isFileNameValid (std::u16string_view i_rFileName)
 would storing the file to a XStorage succeed? More...
 
static bool sfx2::splitPath (OUString const &i_rPath, OUString &o_rDir, OUString &o_rRest)
 split a uri hierarchy into first segment and rest More...
 
static bool sfx2::splitXmlId (std::u16string_view i_XmlId, OUString &o_StreamName, OUString &o_Idref)
 
static uno::Reference< rdf::XURI > sfx2::getURIForStream (struct DocumentMetadataAccess_Impl const &i_rImpl, OUString const &i_rPath)
 
static void sfx2::addFile (struct DocumentMetadataAccess_Impl const &i_rImpl, uno::Reference< rdf::XURI > const &i_xType, OUString const &i_rPath, const uno::Sequence< uno::Reference< rdf::XURI > > *i_pTypes)
 add statements declaring i_xResource to be a file of type i_xType with path i_rPath to manifest, with optional additional types i_pTypes More...
 
static bool sfx2::addContentOrStylesFileImpl (struct DocumentMetadataAccess_Impl const &i_rImpl, const OUString &i_rPath)
 add content.xml or styles.xml to manifest More...
 
static void sfx2::addMetadataFileImpl (struct DocumentMetadataAccess_Impl const &i_rImpl, const OUString &i_rPath, const uno::Sequence< uno::Reference< rdf::XURI > > &i_rTypes)
 add metadata file to manifest More...
 
static void sfx2::removeFile (struct DocumentMetadataAccess_Impl const &i_rImpl, uno::Reference< rdf::XURI > const &i_xPart)
 remove a file from the manifest More...
 
static ::std::vector< uno::Reference< rdf::XURI > > sfx2::getAllParts (struct DocumentMetadataAccess_Impl const &i_rImpl)
 
static bool sfx2::isPartOfType (struct DocumentMetadataAccess_Impl const &i_rImpl, uno::Reference< rdf::XURI > const &i_xPart, uno::Reference< rdf::XURI > const &i_xType)
 
static ::std::vector< uno::Reference< rdf::XURI > > sfx2::getAllParts (struct DocumentMetadataAccess_Impl const &i_rImpl, const uno::Reference< rdf::XURI > &i_xType)
 
static ucb::InteractiveAugmentedIOException sfx2::mkException (OUString const &i_rMessage, ucb::IOErrorCode const i_ErrorCode, OUString const &i_rUri, OUString const &i_rResource)
 
static bool sfx2::handleError (ucb::InteractiveAugmentedIOException const &i_rException, const uno::Reference< task::XInteractionHandler > &i_xHandler)
 error handling policy. More...
 
static void sfx2::collectFilesFromStorage (uno::Reference< embed::XStorage > const &i_xStorage, std::set< OUString > &o_rFiles)
 check if storage has content.xml/styles.xml; e.g. More...
 
static void sfx2::readStream (struct DocumentMetadataAccess_Impl &i_rImpl, uno::Reference< embed::XStorage > const &i_xStorage, OUString const &i_rPath, OUString const &i_rBaseURI)
 import a metadata file into repository More...
 
static void sfx2::importFile (struct DocumentMetadataAccess_Impl &i_rImpl, uno::Reference< embed::XStorage > const &i_xStorage, OUString const &i_rBaseURI, uno::Reference< task::XInteractionHandler > const &i_xHandler, const OUString &i_rPath)
 import a metadata file into repository More...
 
static void sfx2::exportStream (struct DocumentMetadataAccess_Impl const &i_rImpl, uno::Reference< embed::XStorage > const &i_xStorage, uno::Reference< rdf::XURI > const &i_xGraphName, OUString const &i_rFileName, OUString const &i_rBaseURI)
 actually write a metadata file to the storage More...
 
static void sfx2::writeStream (struct DocumentMetadataAccess_Impl &i_rImpl, uno::Reference< embed::XStorage > const &i_xStorage, uno::Reference< rdf::XURI > const &i_xGraphName, OUString const &i_rPath, OUString const &i_rBaseURI)
 write a metadata file to the storage More...
 
static void sfx2::initLoading (struct DocumentMetadataAccess_Impl &i_rImpl, const uno::Reference< embed::XStorage > &i_xStorage, const uno::Reference< rdf::XURI > &i_xBaseURI, const uno::Reference< task::XInteractionHandler > &i_xHandler)
 
static void sfx2::init (struct DocumentMetadataAccess_Impl &i_rImpl)
 init Impl struct More...
 

Variables

constexpr OUStringLiteral sfx2::s_content = u"content.xml"
 
constexpr OUStringLiteral sfx2::s_styles = u"styles.xml"
 
constexpr OUStringLiteral sfx2::s_manifest = u"manifest.rdf"
 
const char sfx2::s_odfmime [] = "application/vnd.oasis.opendocument."