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_WRITERFILTER_SOURCE_DMAPPER_DOMAINMAPPERTABLEHANDLER_HXX
20 : #define INCLUDED_WRITERFILTER_SOURCE_DMAPPER_DOMAINMAPPERTABLEHANDLER_HXX
21 :
22 : #include <TableManager.hxx>
23 : #include <PropertyMap.hxx>
24 : #include <vector>
25 :
26 : #include <com/sun/star/text/XTextAppendAndConvert.hpp>
27 :
28 : namespace writerfilter {
29 : namespace dmapper {
30 :
31 : typedef css::uno::Reference< css::text::XTextRange > Handle_t;
32 : typedef css::uno::Sequence<Handle_t> CellSequence_t;
33 : typedef std::shared_ptr<CellSequence_t> CellSequencePointer_t;
34 : typedef css::uno::Sequence<CellSequence_t> RowSequence_t;
35 : typedef std::shared_ptr<RowSequence_t> RowSequencePointer_t;
36 : typedef css::uno::Sequence<RowSequence_t> TableSequence_t;
37 : typedef std::shared_ptr<TableSequence_t> TableSequencePointer_t;
38 : typedef css::text::XTextAppendAndConvert Text_t;
39 : typedef css::uno::Reference<Text_t> TextReference_t;
40 :
41 : typedef css::beans::PropertyValues TablePropertyValues_t;
42 : typedef css::uno::Sequence<TablePropertyValues_t> RowPropertyValuesSeq_t;
43 : typedef css::uno::Sequence<RowPropertyValuesSeq_t> CellPropertyValuesSeq_t;
44 :
45 : typedef std::vector<PropertyMapPtr> PropertyMapVector1;
46 : typedef std::vector<PropertyMapVector1> PropertyMapVector2;
47 :
48 : class DomainMapper_Impl;
49 : class TableStyleSheetEntry;
50 : struct TableInfo;
51 :
52 : /// A horizontally merged cell is in fact a range of cells till its merge is performed.
53 : struct HorizontallyMergedCell
54 : {
55 : sal_Int32 m_nFirstRow;
56 : sal_Int32 m_nFirstCol;
57 : sal_Int32 m_nLastRow;
58 : sal_Int32 m_nLastCol;
59 2 : HorizontallyMergedCell(sal_Int32 nFirstRow, sal_Int32 nFirstCol)
60 : : m_nFirstRow(nFirstRow)
61 : , m_nFirstCol(nFirstCol)
62 : , m_nLastRow(0)
63 2 : , m_nLastCol(0)
64 : {
65 2 : }
66 : };
67 :
68 : class DomainMapperTableHandler : public TableDataHandler
69 : {
70 : TextReference_t m_xText;
71 : DomainMapper_Impl& m_rDMapper_Impl;
72 : CellSequencePointer_t m_pCellSeq;
73 : RowSequencePointer_t m_pRowSeq;
74 : TableSequencePointer_t m_pTableSeq;
75 :
76 : Handle_t m_xTableRange;
77 :
78 : // properties
79 : PropertyMapVector2 m_aCellProperties;
80 : PropertyMapVector1 m_aRowProperties;
81 : TablePropertyMapPtr m_aTableProperties;
82 :
83 : sal_Int32 m_nCellIndex;
84 : sal_Int32 m_nRowIndex;
85 :
86 : TableStyleSheetEntry * endTableGetTableStyle(TableInfo & rInfo, std::vector<css::beans::PropertyValue>& rFrameProperties);
87 : CellPropertyValuesSeq_t endTableGetCellProperties(TableInfo & rInfo, std::vector<HorizontallyMergedCell>& rMerges);
88 : RowPropertyValuesSeq_t endTableGetRowProperties();
89 :
90 : public:
91 : typedef std::shared_ptr<DomainMapperTableHandler> Pointer_t;
92 :
93 : DomainMapperTableHandler(TextReference_t const& xText,
94 : DomainMapper_Impl& rDMapper_Impl);
95 : virtual ~DomainMapperTableHandler();
96 :
97 : virtual void startTable(unsigned int nRows, unsigned int nDepth,
98 : TablePropertyMapPtr pProps) SAL_OVERRIDE;
99 : virtual void endTable(unsigned int nestedTableLevel) SAL_OVERRIDE;
100 : virtual void startRow(unsigned int nCells, TablePropertyMapPtr pProps) SAL_OVERRIDE;
101 : virtual void endRow() SAL_OVERRIDE;
102 : virtual void startCell(const Handle_t & start, TablePropertyMapPtr pProps) SAL_OVERRIDE;
103 : virtual void endCell(const Handle_t & end) SAL_OVERRIDE;
104 :
105 : Handle_t& getTable() { return m_xTableRange; };
106 : };
107 :
108 : }}
109 :
110 : #endif // INCLUDED_WRITERFILTER_SOURCE_DMAPPER_DOMAINMAPPERTABLEHANDLER_HXX
111 :
112 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|