xref: /aoo42x/main/xmloff/inc/RDFaImportHelper.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef RDFAIMPORTHELPER_HXX
29 #define RDFAIMPORTHELPER_HXX
30 
31 #include <vector>
32 
33 #include <boost/shared_ptr.hpp>
34 
35 #include <com/sun/star/uno/Reference.h>
36 
37 
38 namespace rtl { class OUString; }
39 
40 namespace com { namespace sun { namespace star {
41     namespace uno { class XComponentContext; }
42     namespace rdf { class XMetadatable; }
43     namespace rdf { class XRepositorySupplier; }
44 } } }
45 
46 class SvXMLImport;
47 
48 namespace xmloff {
49 
50 struct RDFaEntry;
51 struct ParsedRDFaAttributes;
52 
53 class SAL_DLLPRIVATE RDFaImportHelper
54 {
55 
56 private:
57     const SvXMLImport & m_rImport;
58 
59     typedef ::std::vector< RDFaEntry > RDFaEntries_t;
60 
61     RDFaEntries_t m_RDFaEntries;
62 
63     const SvXMLImport & GetImport() const { return m_rImport; }
64 
65 
66 public:
67     RDFaImportHelper(const SvXMLImport & i_rImport);
68 
69     ~RDFaImportHelper();
70 
71     /** Parse RDFa attributes */
72     ::boost::shared_ptr<ParsedRDFaAttributes> ParseRDFa(
73         ::rtl::OUString const & i_rAbout,
74         ::rtl::OUString const & i_rProperty,
75         ::rtl::OUString const & i_rContent,
76         ::rtl::OUString const & i_rDatatype);
77 
78     /** Add a RDFa statement; must have been parsed with ParseRDFa */
79     void AddRDFa(
80         ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XMetadatable>
81             const & i_xObject,
82         ::boost::shared_ptr<ParsedRDFaAttributes> & i_pRDFaAttributes);
83 
84     /** Parse and add a RDFa statement; parameters are XML attribute values */
85     void ParseAndAddRDFa(
86         ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XMetadatable>
87             const & i_xObject,
88         ::rtl::OUString const & i_rAbout,
89         ::rtl::OUString const & i_rProperty,
90         ::rtl::OUString const & i_rContent,
91         ::rtl::OUString const & i_rDatatype);
92 
93     /** Insert all added statements into the RDF repository.
94         <p> This is done <em>after</em> the input file has been read,
95         to prevent collision between generated ids and ids in the file.</p>
96      */
97     void InsertRDFa( ::com::sun::star::uno::Reference<
98         ::com::sun::star::rdf::XRepositorySupplier > const & i_xModel);
99 };
100 
101 } // namespace xmloff
102 
103 #endif // RDFAIMPORTHELPER_HXX
104 
105