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::Sequence
< css::uno::Reference
< css::text::XTextRange
> > CellSequence_t
;
32 typedef css::uno::Sequence
<CellSequence_t
> RowSequence_t
;
34 typedef css::uno::Sequence
< css::uno::Sequence
<css::beans::PropertyValues
> > CellPropertyValuesSeq_t
;
36 typedef std::vector
<PropertyMapPtr
> PropertyMapVector1
;
37 typedef std::vector
<PropertyMapVector1
> PropertyMapVector2
;
39 class DomainMapper_Impl
;
40 class TableStyleSheetEntry
;
43 /// A horizontally merged cell is in fact a range of cells till its merge is performed.
44 struct HorizontallyMergedCell
46 sal_Int32
const m_nFirstRow
;
47 sal_Int32
const m_nFirstCol
;
50 HorizontallyMergedCell(sal_Int32 nFirstRow
, sal_Int32 nFirstCol
)
51 : m_nFirstRow(nFirstRow
)
52 , m_nFirstCol(nFirstCol
)
53 , m_nLastRow(nFirstRow
)
59 /// Class to handle events generated by TableManager::resolveCurrentTable().
60 class DomainMapperTableHandler final
: public virtual SvRefBase
62 css::uno::Reference
<css::text::XTextAppendAndConvert
> m_xText
;
63 DomainMapper_Impl
& m_rDMapper_Impl
;
64 std::vector
< css::uno::Reference
<css::text::XTextRange
> > m_aCellRange
;
65 std::vector
<CellSequence_t
> m_aRowRanges
;
66 std::vector
<RowSequence_t
> m_aTableRanges
;
69 PropertyMapVector2 m_aCellProperties
;
70 PropertyMapVector1 m_aRowProperties
;
71 TablePropertyMapPtr m_aTableProperties
;
73 /// Did we have a foot or endnote in this table?
74 bool m_bHadFootOrEndnote
;
76 TableStyleSheetEntry
* endTableGetTableStyle(TableInfo
& rInfo
, std::vector
<css::beans::PropertyValue
>& rFrameProperties
);
77 CellPropertyValuesSeq_t
endTableGetCellProperties(TableInfo
& rInfo
, std::vector
<HorizontallyMergedCell
>& rMerges
);
78 css::uno::Sequence
<css::beans::PropertyValues
> endTableGetRowProperties();
81 typedef tools::SvRef
<DomainMapperTableHandler
> Pointer_t
;
83 DomainMapperTableHandler(css::uno::Reference
<css::text::XTextAppendAndConvert
> const& xText
,
84 DomainMapper_Impl
& rDMapper_Impl
);
85 ~DomainMapperTableHandler() override
;
88 Handle start of table.
90 @param pProps properties of the table
92 void startTable(const TablePropertyMapPtr
& pProps
);
93 /// Handle end of table.
94 void endTable(unsigned int nestedTableLevel
, bool bTableStartsAtCellStart
);
98 @param pProps properties of the row
100 void startRow(const TablePropertyMapPtr
& pProps
);
101 /// Handle end of row.
104 Handle start of cell.
106 @param rT start handle of the cell
107 @param pProps properties of the cell
109 void startCell(const css::uno::Reference
< css::text::XTextRange
> & start
, const TablePropertyMapPtr
& pProps
);
113 @param rT end handle of cell
115 void endCell(const css::uno::Reference
< css::text::XTextRange
> & end
);
117 void setHadFootOrEndnote(bool bHadFootOrEndnote
);
119 DomainMapper_Impl
& getDomainMapperImpl();
124 #endif // INCLUDED_WRITERFILTER_SOURCE_DMAPPER_DOMAINMAPPERTABLEHANDLER_HXX
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */