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 XMLTABLEIMPORT_HXX_
29 #define XMLTABLEIMPORT_HXX_
30 
31 #include <com/sun/star/table/XColumnRowRange.hpp>
32 
33 #include "xmloff/dllapi.h"
34 #include "xmloff/xmlictxt.hxx"
35 #include "xmloff/uniref.hxx"
36 #include "xmloff/xmlimppr.hxx"
37 #include "xmloff/prhdlfac.hxx"
38 
39 #include <rtl/ref.hxx>
40 
41 #include <boost/shared_ptr.hpp>
42 #include <map>
43 
44 class SvXMLStyleContext;
45 
46 typedef std::map< ::rtl::OUString, ::rtl::OUString > XMLTableTemplate;
47 typedef std::map < ::rtl::OUString, boost::shared_ptr< XMLTableTemplate > > XMLTableTemplateMap;
48 
49 class XMLTableImport : public UniRefBase
50 {
51 	friend class XMLTableImportContext;
52 
53 public:
54 	XMLTableImport( SvXMLImport& rImport, const rtl::Reference< XMLPropertySetMapper >& xCellPropertySetMapper, const rtl::Reference< XMLPropertyHandlerFactory >& xFactoryRef );
55 	virtual ~XMLTableImport();
56 
57 	SvXMLImportContext* CreateTableContext( sal_uInt16 nPrfx, const ::rtl::OUString& rLName,
58 											::com::sun::star::uno::Reference< ::com::sun::star::table::XColumnRowRange >& xColumnRowRange );
59 
60 	SvXMLStyleContext* CreateTableTemplateContext( sal_uInt16 nPrfx, const ::rtl::OUString& rLName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
61 
62 	rtl::Reference< SvXMLImportPropertyMapper > GetCellImportPropertySetMapper() const { return mxCellImportPropertySetMapper; }
63 	rtl::Reference< SvXMLImportPropertyMapper > GetRowImportPropertySetMapper() const { return mxRowImportPropertySetMapper; }
64 	rtl::Reference< SvXMLImportPropertyMapper > GetColumnImportPropertySetMapper() const { return mxColumnImportPropertySetMapper; }
65 
66 	void addTableTemplate( const rtl::OUString& rsStyleName, XMLTableTemplate& xTableTemplate );
67 	void finishStyles();
68 
69 private:
70 	SvXMLImport&								 mrImport;
71 	rtl::Reference< SvXMLImportPropertyMapper > mxCellImportPropertySetMapper;
72 	rtl::Reference< SvXMLImportPropertyMapper > mxRowImportPropertySetMapper;
73 	rtl::Reference< SvXMLImportPropertyMapper > mxColumnImportPropertySetMapper;
74 
75 	XMLTableTemplateMap							maTableTemplates;
76 };
77 
78 #endif /*XMLTABLEIMPORT_HXX_*/
79