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 .
21 #include "PropertyMap.hxx"
24 #include <com/sun/star/text/XTextAppendAndConvert.hpp>
26 namespace writerfilter::dmapper
{
28 typedef css::uno::Sequence
< css::uno::Reference
< css::text::XTextRange
> > CellSequence_t
;
29 typedef css::uno::Sequence
<CellSequence_t
> RowSequence_t
;
31 typedef css::uno::Sequence
< css::uno::Sequence
<css::beans::PropertyValues
> > CellPropertyValuesSeq_t
;
33 typedef std::vector
<PropertyMapPtr
> PropertyMapVector1
;
34 typedef std::vector
<PropertyMapVector1
> PropertyMapVector2
;
36 class DomainMapper_Impl
;
37 class TableStyleSheetEntry
;
40 /// A horizontally merged cell is in fact a range of cells till its merge is performed.
41 struct HorizontallyMergedCell
43 sal_Int32 m_nFirstRow
;
44 sal_Int32 m_nFirstCol
;
47 HorizontallyMergedCell(sal_Int32 nFirstRow
, sal_Int32 nFirstCol
)
48 : m_nFirstRow(nFirstRow
)
49 , m_nFirstCol(nFirstCol
)
50 , m_nLastRow(nFirstRow
)
56 /// Class to handle events generated by TableManager::resolveCurrentTable().
57 class DomainMapperTableHandler final
: public virtual SvRefBase
59 css::uno::Reference
<css::text::XTextAppendAndConvert
> m_xText
;
60 DomainMapper_Impl
& m_rDMapper_Impl
;
61 std::vector
< css::uno::Reference
<css::text::XTextRange
> > m_aCellRange
;
62 std::vector
<CellSequence_t
> m_aRowRanges
;
63 std::vector
<RowSequence_t
> m_aTableRanges
;
66 PropertyMapVector2 m_aCellProperties
;
67 PropertyMapVector1 m_aRowProperties
;
68 TablePropertyMapPtr m_aTableProperties
;
70 /// Did we have a foot or endnote in this table?
71 bool m_bHadFootOrEndnote
;
73 TableStyleSheetEntry
* endTableGetTableStyle(TableInfo
& rInfo
,
74 std::vector
<css::beans::PropertyValue
>& rFrameProperties
,
75 bool bConvertToFloating
);
76 CellPropertyValuesSeq_t
endTableGetCellProperties(TableInfo
& rInfo
, std::vector
<HorizontallyMergedCell
>& rMerges
);
77 css::uno::Sequence
<css::beans::PropertyValues
> endTableGetRowProperties();
80 typedef tools::SvRef
<DomainMapperTableHandler
> Pointer_t
;
82 DomainMapperTableHandler(css::uno::Reference
<css::text::XTextAppendAndConvert
> xText
,
83 DomainMapper_Impl
& rDMapper_Impl
);
84 ~DomainMapperTableHandler() override
;
87 Handle start of table.
89 @param pProps properties of the table
91 void startTable(const TablePropertyMapPtr
& pProps
);
93 void ApplyParagraphPropertiesFromTableStyle(TableParagraph rParaProp
, std::vector
< PropertyIds
> aAllTableProperties
, const css::beans::PropertyValues rCellProperties
);
95 /// Handle end of table.
96 void endTable(unsigned int nestedTableLevel
);
100 @param pProps properties of the row
102 void startRow(const TablePropertyMapPtr
& pProps
);
103 /// Handle end of row.
106 Handle start of cell.
108 @param rT start handle of the cell
109 @param pProps properties of the cell
111 void startCell(const css::uno::Reference
< css::text::XTextRange
> & start
, const TablePropertyMapPtr
& pProps
);
115 @param rT end handle of cell
117 void endCell(const css::uno::Reference
< css::text::XTextRange
> & end
);
119 void setHadFootOrEndnote(bool bHadFootOrEndnote
);
121 DomainMapper_Impl
& getDomainMapperImpl();
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */