1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_WRITERFILTER_SOURCE_DMAPPER_DOMAINMAPPERTABLEHANDLER_HXX
20 #define INCLUDED_WRITERFILTER_SOURCE_DMAPPER_DOMAINMAPPERTABLEHANDLER_HXX
22 #include <TableManager.hxx>
23 #include <PropertyMap.hxx>
26 #include <com/sun/star/text/XTextAppendAndConvert.hpp>
28 namespace writerfilter
{
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
;
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
;
45 typedef std::vector
<PropertyMapPtr
> PropertyMapVector1
;
46 typedef std::vector
<PropertyMapVector1
> PropertyMapVector2
;
48 class DomainMapper_Impl
;
49 class TableStyleSheetEntry
;
52 /// A horizontally merged cell is in fact a range of cells till its merge is performed.
53 struct HorizontallyMergedCell
55 sal_Int32 m_nFirstRow
;
56 sal_Int32 m_nFirstCol
;
59 HorizontallyMergedCell(sal_Int32 nFirstRow
, sal_Int32 nFirstCol
)
60 : m_nFirstRow(nFirstRow
)
61 , m_nFirstCol(nFirstCol
)
68 class DomainMapperTableHandler
: public TableDataHandler
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
;
76 Handle_t m_xTableRange
;
79 PropertyMapVector2 m_aCellProperties
;
80 PropertyMapVector1 m_aRowProperties
;
81 TablePropertyMapPtr m_aTableProperties
;
83 sal_Int32 m_nCellIndex
;
84 sal_Int32 m_nRowIndex
;
86 /// Did we have a foot or endnote in this table?
87 bool m_bHadFootOrEndnote
;
89 TableStyleSheetEntry
* endTableGetTableStyle(TableInfo
& rInfo
, std::vector
<css::beans::PropertyValue
>& rFrameProperties
);
90 CellPropertyValuesSeq_t
endTableGetCellProperties(TableInfo
& rInfo
, std::vector
<HorizontallyMergedCell
>& rMerges
);
91 RowPropertyValuesSeq_t
endTableGetRowProperties();
94 typedef std::shared_ptr
<DomainMapperTableHandler
> Pointer_t
;
96 DomainMapperTableHandler(TextReference_t
const& xText
,
97 DomainMapper_Impl
& rDMapper_Impl
);
98 virtual ~DomainMapperTableHandler();
100 virtual void startTable(unsigned int nRows
, unsigned int nDepth
,
101 TablePropertyMapPtr pProps
) SAL_OVERRIDE
;
102 virtual void endTable(unsigned int nestedTableLevel
) SAL_OVERRIDE
;
103 virtual void startRow(unsigned int nCells
, TablePropertyMapPtr pProps
) SAL_OVERRIDE
;
104 virtual void endRow() SAL_OVERRIDE
;
105 virtual void startCell(const Handle_t
& start
, TablePropertyMapPtr pProps
) SAL_OVERRIDE
;
106 virtual void endCell(const Handle_t
& end
) SAL_OVERRIDE
;
108 Handle_t
& getTable() { return m_xTableRange
; };
109 void setHadFootOrEndnote(bool bHadFootOrEndnote
);
114 #endif // INCLUDED_WRITERFILTER_SOURCE_DMAPPER_DOMAINMAPPERTABLEHANDLER_HXX
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */