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_DOMAIN_MAPPER_TABLE_HANDLER_HXX
20 #define INCLUDED_DOMAIN_MAPPER_TABLE_HANDLER_HXX
22 #include <resourcemodel/TableManager.hxx>
23 #include <PropertyMap.hxx>
25 #include <com/sun/star/text/XTextAppendAndConvert.hpp>
27 namespace writerfilter
{
30 typedef ::com::sun::star::text::XTextRange TextRange_t
;
31 typedef ::com::sun::star::uno::Reference
< TextRange_t
> Handle_t
;
32 typedef ::com::sun::star::uno::Sequence
< Handle_t
> CellSequence_t
;
33 typedef boost::shared_ptr
<CellSequence_t
> CellSequencePointer_t
;
34 typedef ::com::sun::star::uno::Sequence
< CellSequence_t
> RowSequence_t
;
35 typedef boost::shared_ptr
<RowSequence_t
> RowSequencePointer_t
;
36 typedef ::com::sun::star::uno::Sequence
< RowSequence_t
> TableSequence_t
;
37 typedef boost::shared_ptr
<TableSequence_t
> TableSequencePointer_t
;
38 typedef ::com::sun::star::text::XTextAppendAndConvert Text_t
;
39 typedef ::com::sun::star::uno::Reference
<Text_t
> TextReference_t
;
41 typedef ::com::sun::star::beans::PropertyValues TablePropertyValues_t
;
42 typedef ::com::sun::star::uno::Sequence
< TablePropertyValues_t
> RowPropertyValuesSeq_t
;
43 typedef ::com::sun::star::uno::Sequence
< RowPropertyValuesSeq_t
> CellPropertyValuesSeq_t
;
45 typedef std::vector
<PropertyMapPtr
> PropertyMapVector1
;
46 typedef std::vector
<PropertyMapVector1
> PropertyMapVector2
;
48 #define DEF_BORDER_DIST 190 //0,19cm
50 class DomainMapper_Impl
;
51 class TableStyleSheetEntry
;
54 /// A horizontally merged cell is in fact a range of cells till its merge is performed.
55 struct HorizontallyMergedCell
57 sal_Int32 m_nFirstRow
;
58 sal_Int32 m_nFirstCol
;
61 HorizontallyMergedCell(sal_Int32 nFirstRow
, sal_Int32 nFirstCol
)
62 : m_nFirstRow(nFirstRow
),
63 m_nFirstCol(nFirstCol
)
68 class WRITERFILTER_DLLPRIVATE DomainMapperTableHandler
: public TableDataHandler
<Handle_t
, TablePropertyMapPtr
>
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 TableStyleSheetEntry
* endTableGetTableStyle(TableInfo
& rInfo
, uno::Sequence
<beans::PropertyValue
>& rFrameProperties
);
87 CellPropertyValuesSeq_t
endTableGetCellProperties(TableInfo
& rInfo
, std::vector
<HorizontallyMergedCell
>& rMerges
);
88 RowPropertyValuesSeq_t
endTableGetRowProperties();
91 typedef boost::shared_ptr
<DomainMapperTableHandler
> Pointer_t
;
93 DomainMapperTableHandler(TextReference_t xText
, DomainMapper_Impl
& rDMapper_Impl
);
94 virtual ~DomainMapperTableHandler();
96 virtual void startTable(unsigned int nRows
, unsigned int nDepth
,
97 TablePropertyMapPtr pProps
);
98 virtual void endTable(unsigned int nestedTableLevel
);
99 virtual void startRow(unsigned int nCells
, TablePropertyMapPtr pProps
);
100 virtual void endRow();
101 virtual void startCell(const Handle_t
& start
, TablePropertyMapPtr pProps
);
102 virtual void endCell(const Handle_t
& end
);
104 virtual Handle_t
* getTable( )
106 return &m_xTableRange
;
112 #endif // INCLUDED_DOMAIN_MAPPER_TABLE_HANDLER_HXX
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */