update emoji autocorrect entries from po-files
[LibreOffice.git] / writerfilter / source / dmapper / DomainMapperTableManager.hxx
blob79338b0337fe387a863ae97a60ffea5c11f1e4de
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_DOMAINMAPPERTABLEMANAGER_HXX
20 #define INCLUDED_WRITERFILTER_SOURCE_DMAPPER_DOMAINMAPPERTABLEMANAGER_HXX
22 #include "TablePropertiesHandler.hxx"
23 #include "TablePositionHandler.hxx"
25 #include <TableManager.hxx>
26 #include "PropertyMap.hxx"
27 #include "StyleSheetTable.hxx"
28 #include <com/sun/star/text/XTextRange.hpp>
29 #include <vector>
30 #include <comphelper/sequenceashashmap.hxx>
32 namespace writerfilter {
33 namespace dmapper {
35 class DomainMapper;
37 class DomainMapperTableManager : public TableManager
39 typedef std::shared_ptr< std::vector<sal_Int32> > IntVectorPtr;
41 sal_uInt32 m_nRow;
42 ::std::vector< sal_uInt32 > m_nCell;
43 sal_uInt32 m_nGridSpan;
44 sal_uInt32 m_nGridBefore; ///< number of grid columns in the parent table's table grid which must be skipped before the contents of this table row are added to the parent table
45 sal_uInt32 m_nGridAfter; ///< number of grid columns in the parent table's table grid which shall be left after the last cell in the table row
46 sal_uInt32 m_nCellBorderIndex; //borders are provided for all cells and need counting
47 sal_Int32 m_nHeaderRepeat; //counter of repeated headers - if == -1 then the repeating stops
48 sal_Int32 m_nTableWidth; //might be set directly or has to be calculated from the column positions
49 /// Are we in a shape (text append stack is not empty) or in the body document?
50 bool m_bIsInShape;
51 OUString m_sTableStyleName;
52 /// Grab-bag of table look attributes for preserving.
53 comphelper::SequenceAsHashMap m_aTableLook;
54 std::vector< TablePositionHandlerPtr > m_aTablePositions;
55 std::vector< TablePositionHandlerPtr > m_aTmpPosition; ///< Temporarily stores the position to compare it later
56 std::vector< TablePropertyMapPtr > m_aTmpTableProperties; ///< Temporarily stores the table properties until end of row
57 PropertyMapPtr m_pTableStyleTextProperies;
59 ::std::vector< IntVectorPtr > m_aTableGrid;
60 ::std::vector< IntVectorPtr > m_aGridSpans;
61 /// If this is true, then we pushed a width before the next level started, and that should be carried over when starting the next level.
62 bool m_bPushCurrentWidth;
63 /// Individual table cell width values, used only in case the number of cells doesn't match the table grid.
64 ::std::vector< IntVectorPtr > m_aCellWidths;
65 /// Remember if a cell already set this, then it should not be set at a row level.
66 bool m_bRowSizeTypeInserted;
67 /// At least one cell in the current row has the btLr text direction.
68 bool m_bHasBtlrCell;
69 /// Remember if table width was already set, when we lack a w:tblW, it should be set manually at the end.
70 bool m_bTableSizeTypeInserted;
71 /// Table layout algorithm, IOW if we should consider fixed column width or not.
72 sal_uInt32 m_nLayoutType;
73 sal_Int32 m_nMaxFixedWidth;
75 TablePropertiesHandler *m_pTablePropsHandler;
76 PropertyMapPtr m_pStyleProps;
78 virtual void clearData() SAL_OVERRIDE;
80 public:
82 DomainMapperTableManager();
83 virtual ~DomainMapperTableManager();
85 // use this method to avoid adding the properties for the table
86 // but in the provided properties map.
87 inline void SetStyleProperties( PropertyMapPtr pProperties ) { m_pStyleProps = pProperties; };
89 virtual bool sprm(Sprm & rSprm) SAL_OVERRIDE;
90 bool attribute(Id nName, Value & val);
92 virtual void startLevel( ) SAL_OVERRIDE;
93 virtual void endLevel( ) SAL_OVERRIDE;
95 virtual void endOfCellAction() SAL_OVERRIDE;
96 virtual void endOfRowAction() SAL_OVERRIDE;
98 IntVectorPtr getCurrentGrid( );
99 IntVectorPtr getCurrentSpans( );
100 IntVectorPtr getCurrentCellWidths( );
102 const OUString& getTableStyleName() const { return m_sTableStyleName; }
103 /// Turn the attributes collected so far in m_aTableLook into a property and clear the container.
104 void finishTableLook();
105 const css::uno::Sequence<css::beans::PropertyValue> getCurrentTablePosition();
106 TablePositionHandler* getCurrentTableRealPosition();
108 virtual void cellProps(TablePropertyMapPtr pProps) SAL_OVERRIDE
110 if ( m_pStyleProps.get( ) )
111 m_pStyleProps->InsertProps(pProps);
112 else
113 TableManager::cellProps( pProps );
116 virtual void cellPropsByCell(unsigned int i, TablePropertyMapPtr pProps) SAL_OVERRIDE
118 if ( m_pStyleProps.get( ) )
119 m_pStyleProps->InsertProps(pProps);
120 else
121 TableManager::cellPropsByCell( i, pProps );
124 virtual void insertRowProps(TablePropertyMapPtr pProps) SAL_OVERRIDE
126 if ( m_pStyleProps.get( ) )
127 m_pStyleProps->InsertProps(pProps);
128 else
129 TableManager::insertRowProps( pProps );
132 virtual void insertTableProps(TablePropertyMapPtr pProps) SAL_OVERRIDE
134 if ( m_pStyleProps.get( ) )
135 m_pStyleProps->InsertProps(pProps);
136 else
137 m_aTmpTableProperties.back()->InsertProps(pProps);
140 bool IsRowSizeTypeInserted() const
142 return m_bRowSizeTypeInserted;
145 bool HasBtlrCell() const
147 return m_bHasBtlrCell;
150 bool IsTableSizeTypeInserted() const
152 return m_bTableSizeTypeInserted;
155 void SetLayoutType(sal_uInt32 nLayoutType)
157 m_nLayoutType = nLayoutType;
160 bool isInCell()
162 return TableManager::isInCell();
165 void setIsInShape(bool bIsInShape);
171 #endif // INCLUDED_WRITERFILTER_SOURCE_DMAPPER_DOMAINMAPPERTABLEMANAGER_HXX
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */