sc: filter: rtf: add method "AddFont"
[LibreOffice.git] / include / sfx2 / DocumentMetadataAccess.hxx
blobbcbf9f1b38492959356bb524053d7151e019f81d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SFX2_DOCUMENTMETADATAACCESS_HXX
21 #define INCLUDED_SFX2_DOCUMENTMETADATAACCESS_HXX
23 #include <sal/config.h>
25 #include <sfx2/dllapi.h>
27 #include <com/sun/star/rdf/XDocumentMetadataAccess.hpp>
29 #include <cppuhelper/implbase.hxx>
31 #include <memory>
34 /** Implementation of the interface com.sun.star.rdf.XDocumentMetadataAccess
36 This is not a service only because it needs some kind of XML ID registry
37 from the document, and i do not like defining an API for that.
38 Also, the implementation does _no_ locking, so make sure access is
39 protected externally.
42 namespace com::sun::star::embed {
43 class XStorage;
45 namespace com::sun::star::frame {
46 class XModel;
49 namespace com::sun::star::uno { class XComponentContext; }
51 class SfxObjectShell;
53 namespace sfx2 {
56 /** create a base URI for loading metadata from an ODF (sub)document.
58 @param i_xContext component context
59 @param i_xModel model of the document (required if no URI is provided)
60 @param i_rPkgURI the URI for the package
61 @param i_rSubDocument (optional) path of the subdocument in package
63 @return a base URI suitable for XDocumentMetadataAccess::loadFromStorage
65 css::uno::Reference< css::rdf::XURI> SFX2_DLLPUBLIC
66 createBaseURI(
67 css::uno::Reference<css::uno::XComponentContext> const & i_xContext,
68 css::uno::Reference<css::frame::XModel> const & i_xModel,
69 OUString const & i_rPkgURI,
70 std::u16string_view i_rSubDocument = std::u16string_view());
73 struct DocumentMetadataAccess_Impl;
75 class DocumentMetadataAccess final :
76 public cppu::WeakImplHelper<css::rdf::XDocumentMetadataAccess>
78 DocumentMetadataAccess(const DocumentMetadataAccess&) = delete;
79 DocumentMetadataAccess& operator=( const DocumentMetadataAccess& ) = delete;
80 public:
81 explicit DocumentMetadataAccess(css::uno::Reference< css::uno::XComponentContext > const & i_xContext,
82 SfxObjectShell const & i_rRegistrySupplier,
83 OUString const & i_rBaseURI);
84 // N.B.: in contrast to previous, this constructor does _not_ initialize!
85 // caller must immediately call loadFromStorage/Medium!
86 explicit DocumentMetadataAccess(css::uno::Reference< css::uno::XComponentContext > const & i_xContext,
87 SfxObjectShell const & i_rRegistrySupplier);
88 virtual ~DocumentMetadataAccess() override;
90 // css::rdf::XNode:
91 virtual OUString SAL_CALL getStringValue() override;
93 // css::rdf::XURI:
94 virtual OUString SAL_CALL getNamespace() override;
95 virtual OUString SAL_CALL getLocalName() override;
97 // css::rdf::XRepositorySupplier:
98 virtual css::uno::Reference<
99 css::rdf::XRepository > SAL_CALL getRDFRepository() override;
101 // css::rdf::XDocumentMetadataAccess:
102 virtual css::uno::Reference<
103 css::rdf::XMetadatable > SAL_CALL
104 getElementByMetadataReference(
105 const css::beans::StringPair & i_rReference) override;
106 virtual css::uno::Reference< css::rdf::XMetadatable > SAL_CALL
107 getElementByURI(const css::uno::Reference< css::rdf::XURI > & i_xURI) override;
108 virtual css::uno::Sequence< css::uno::Reference< css::rdf::XURI > > SAL_CALL getMetadataGraphsWithType(
109 const css::uno::Reference< css::rdf::XURI > & i_xType) override;
110 virtual css::uno::Reference< css::rdf::XURI> SAL_CALL
111 addMetadataFile(const OUString & i_rFileName,
112 const css::uno::Sequence< css::uno::Reference< css::rdf::XURI > > & i_rTypes) override;
113 virtual css::uno::Reference< css::rdf::XURI> SAL_CALL
114 importMetadataFile(::sal_Int16 i_Format,
115 const css::uno::Reference< css::io::XInputStream > & i_xInStream,
116 const OUString & i_rFileName,
117 const css::uno::Reference< css::rdf::XURI > & i_xBaseURI,
118 const css::uno::Sequence< css::uno::Reference< css::rdf::XURI > > & i_rTypes) override;
119 virtual void SAL_CALL removeMetadataFile(
120 const css::uno::Reference<
121 css::rdf::XURI > & i_xGraphName) override;
122 virtual void SAL_CALL addContentOrStylesFile(
123 const OUString & i_rFileName) override;
124 virtual void SAL_CALL removeContentOrStylesFile(
125 const OUString & i_rFileName) override;
127 virtual void SAL_CALL loadMetadataFromStorage(
128 const css::uno::Reference<
129 css::embed::XStorage > & i_xStorage,
130 const css::uno::Reference<
131 css::rdf::XURI > & i_xBaseURI,
132 const css::uno::Reference<
133 css::task::XInteractionHandler> & i_xHandler) override;
134 virtual void SAL_CALL storeMetadataToStorage(
135 const css::uno::Reference<
136 css::embed::XStorage > & i_xStorage) override;
137 virtual void SAL_CALL loadMetadataFromMedium(
138 const css::uno::Sequence<
139 css::beans::PropertyValue > & i_rMedium) override;
140 virtual void SAL_CALL storeMetadataToMedium(
141 const css::uno::Sequence<
142 css::beans::PropertyValue > & i_rMedium) override;
144 private:
145 std::unique_ptr<DocumentMetadataAccess_Impl> m_pImpl;
148 } // namespace sfx2
150 #endif // INCLUDED_SFX2_DOCUMENTMETADATAACCESS_HXX
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */