1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef RDFAIMPORTHELPER_HXX 25 #define RDFAIMPORTHELPER_HXX 26 27 #include <vector> 28 29 #include <boost/shared_ptr.hpp> 30 31 #include <com/sun/star/uno/Reference.h> 32 33 34 namespace rtl { class OUString; } 35 36 namespace com { namespace sun { namespace star { 37 namespace uno { class XComponentContext; } 38 namespace rdf { class XMetadatable; } 39 namespace rdf { class XRepositorySupplier; } 40 } } } 41 42 class SvXMLImport; 43 44 namespace xmloff { 45 46 struct RDFaEntry; 47 struct ParsedRDFaAttributes; 48 49 class SAL_DLLPRIVATE RDFaImportHelper 50 { 51 52 private: 53 const SvXMLImport & m_rImport; 54 55 typedef ::std::vector< RDFaEntry > RDFaEntries_t; 56 57 RDFaEntries_t m_RDFaEntries; 58 GetImport() const59 const SvXMLImport & GetImport() const { return m_rImport; } 60 61 62 public: 63 RDFaImportHelper(const SvXMLImport & i_rImport); 64 65 ~RDFaImportHelper(); 66 67 /** Parse RDFa attributes */ 68 ::boost::shared_ptr<ParsedRDFaAttributes> ParseRDFa( 69 ::rtl::OUString const & i_rAbout, 70 ::rtl::OUString const & i_rProperty, 71 ::rtl::OUString const & i_rContent, 72 ::rtl::OUString const & i_rDatatype); 73 74 /** Add a RDFa statement; must have been parsed with ParseRDFa */ 75 void AddRDFa( 76 ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XMetadatable> 77 const & i_xObject, 78 ::boost::shared_ptr<ParsedRDFaAttributes> & i_pRDFaAttributes); 79 80 /** Parse and add a RDFa statement; parameters are XML attribute values */ 81 void ParseAndAddRDFa( 82 ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XMetadatable> 83 const & i_xObject, 84 ::rtl::OUString const & i_rAbout, 85 ::rtl::OUString const & i_rProperty, 86 ::rtl::OUString const & i_rContent, 87 ::rtl::OUString const & i_rDatatype); 88 89 /** Insert all added statements into the RDF repository. 90 <p> This is done <em>after</em> the input file has been read, 91 to prevent collision between generated ids and ids in the file.</p> 92 */ 93 void InsertRDFa( ::com::sun::star::uno::Reference< 94 ::com::sun::star::rdf::XRepositorySupplier > const & i_xModel); 95 }; 96 97 } // namespace xmloff 98 99 #endif // RDFAIMPORTHELPER_HXX 100 101