Coverage Report

Created: 2026-08-14 10:22

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/xmloff/table/XMLTableExport.hxx
Line
Count
Source
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
27
#include <map>
28
#include <memory>
29
#include <vector>
30
31
#include <rtl/ref.hxx>
32
33
#include <xmloff/dllapi.h>
34
#include <salhelper/simplereferenceobject.hxx>
35
#include <xmloff/styleexp.hxx>
36
37
class SvXMLExport;
38
class SvXMLExportPropertyMapper;
39
class XMLPropertyHandlerFactory;
40
41
namespace com::sun::star::container { class XIndexAccess; }
42
namespace com::sun::star::table { class XCell; }
43
namespace com::sun::star::table { class XColumnRowRange; }
44
45
typedef std::map< const css::uno::Reference< css::uno::XInterface >, OUString > TableStyleMap;
46
47
struct XMLTableInfo
48
{
49
    TableStyleMap   maColumnStyleMap;
50
    TableStyleMap   maRowStyleMap;
51
    TableStyleMap   maCellStyleMap;
52
    std::vector< OUString > maDefaultRowCellStyles;
53
};
54
55
class XMLOFF_DLLPUBLIC XMLTableExport final : public salhelper::SimpleReferenceObject
56
{
57
public:
58
    XMLTableExport(SvXMLExport& rExp, const rtl::Reference< SvXMLExportPropertyMapper >& xCellExportPropertySetMapper, const rtl::Reference< XMLPropertyHandlerFactory >& xFactoryRef );
59
    virtual ~XMLTableExport() override;
60
61
    // This method collects all automatic styles for the given table
62
    void collectTableAutoStyles(const css::uno::Reference < css::table::XColumnRowRange >& xColumnRowRange);
63
64
    // This method exports the given table
65
    void exportTable(const css::uno::Reference < css::table::XColumnRowRange >& xColumnRowRange);
66
67
    // export the styles from the cell style family
68
    void exportTableStyles();
69
70
    // Export the collected automatic styles
71
    void exportAutoStyles();
72
73
private:
74
    void exportTableTemplates();
75
76
    SvXMLExport&                                    mrExport;
77
    rtl::Reference< SvXMLExportPropertyMapper >     mxCellExportPropertySetMapper;
78
    rtl::Reference< SvXMLExportPropertyMapper >     mxRowExportPropertySetMapper;
79
    rtl::Reference< SvXMLExportPropertyMapper >     mxColumnExportPropertySetMapper;
80
    std::map< const css::uno::Reference< css::table::XColumnRowRange >, std::shared_ptr< XMLTableInfo > >
81
                                                    maTableInfoMap;
82
    bool                                            mbExportTables;
83
    bool                                            mbWriter;
84
85
0
    SvXMLExport& GetExport() { return mrExport; }
86
0
    const SvXMLExport& GetExport() const  { return mrExport; }
87
88
    SAL_DLLPRIVATE void ImpExportText( const css::uno::Reference < css::table::XCell >& xCell );
89
90
    void ExportCell( const css::uno::Reference < css::table::XCell >& xCell, const std::shared_ptr< XMLTableInfo >& pTableInfo, std::u16string_view sDefaultCellStyle  );
91
    void ExportTableColumns( const css::uno::Reference < css::container::XIndexAccess >& xtableColumns, const std::shared_ptr< XMLTableInfo >& pTableInfo );
92
93
};
94
95
class XMLOFF_DLLPUBLIC XMLCellStyleExport final : public XMLStyleExport
96
{
97
    using XMLStyleExport::XMLStyleExport;
98
    virtual void exportStyleAttributes(const css::uno::Reference<css::style::XStyle>& rStyle) override;
99
    virtual void exportStyleContent(const css::uno::Reference<css::style::XStyle>& rStyle) override;
100
};
101
102
#endif
103
104
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */