Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_XMLOFF_TABLE_XMLTABLEEXPORT_HXX
20 : #define INCLUDED_XMLOFF_TABLE_XMLTABLEEXPORT_HXX
21 :
22 : #include <sal/config.h>
23 :
24 : #include <sal/types.h>
25 : #include <rtl/ustring.hxx>
26 : #include <rtl/ustrbuf.hxx>
27 :
28 : #include <map>
29 : #include <memory>
30 : #include <vector>
31 :
32 : #include <com/sun/star/table/XTableColumns.hpp>
33 : #include <com/sun/star/table/XColumnRowRange.hpp>
34 : #include <com/sun/star/table/XCell.hpp>
35 : #include <com/sun/star/text/XText.hpp>
36 : #include <com/sun/star/container/XIndexAccess.hpp>
37 :
38 : #include <rtl/ref.hxx>
39 :
40 : #include <xmloff/dllapi.h>
41 : #include <salhelper/simplereferenceobject.hxx>
42 : #include <xmloff/xmlprmap.hxx>
43 : #include <xmloff/xmlexppr.hxx>
44 :
45 : class SvXMLExport;
46 : class SvXMLExportPropertyMapper;
47 :
48 : typedef std::map< const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >, OUString > TableStyleMap;
49 :
50 0 : struct XMLTableInfo
51 : {
52 : TableStyleMap maColumnStyleMap;
53 : TableStyleMap maRowStyleMap;
54 : TableStyleMap maCellStyleMap;
55 : std::vector< OUString > maDefaultRowCellStyles;
56 : };
57 :
58 : typedef std::map< const ::com::sun::star::uno::Reference< com::sun::star::table::XColumnRowRange >, std::shared_ptr< XMLTableInfo > > TableInfoMap;
59 :
60 : class XMLOFF_DLLPUBLIC XMLTableExport : public salhelper::SimpleReferenceObject
61 : {
62 : public:
63 : XMLTableExport(SvXMLExport& rExp, const rtl::Reference< SvXMLExportPropertyMapper >& xCellExportPropertySetMapper, const rtl::Reference< XMLPropertyHandlerFactory >& xFactoryRef );
64 : virtual ~XMLTableExport();
65 :
66 : // This method collects all automatic styles for the given table
67 : void collectTableAutoStyles(const com::sun::star::uno::Reference < com::sun::star::table::XColumnRowRange >& xColumnRowRange);
68 :
69 : // This method exports the given table
70 : void exportTable(const com::sun::star::uno::Reference < com::sun::star::table::XColumnRowRange >& xColumnRowRange);
71 :
72 : // export the styles from the cell style family
73 : void exportTableStyles();
74 :
75 : // Export the collected automatic styles
76 : void exportAutoStyles();
77 :
78 : private:
79 : void exportTableTemplates();
80 :
81 : SvXMLExport& mrExport;
82 : rtl::Reference< SvXMLExportPropertyMapper > mxCellExportPropertySetMapper;
83 : rtl::Reference< SvXMLExportPropertyMapper > mxRowExportPropertySetMapper;
84 : rtl::Reference< SvXMLExportPropertyMapper > mxColumnExportPropertySetMapper;
85 : TableInfoMap maTableInfoMap;
86 : bool mbExportTables;
87 :
88 : protected:
89 0 : SvXMLExport& GetExport() { return mrExport; }
90 : const SvXMLExport& GetExport() const { return mrExport; }
91 : private:
92 :
93 : SAL_DLLPRIVATE void ImpExportText( const com::sun::star::uno::Reference < com::sun::star::table::XCell >& xCell );
94 :
95 : void ExportCell( const com::sun::star::uno::Reference < com::sun::star::table::XCell >& xCell, const std::shared_ptr< XMLTableInfo >& pTableInfo, const OUString& sDefaultCellStyle );
96 : void ExportTableColumns( const com::sun::star::uno::Reference < com::sun::star::container::XIndexAccess >& xtableColumns, const std::shared_ptr< XMLTableInfo >& pTableInfo );
97 :
98 : };
99 :
100 : #endif
101 :
102 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|