fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / writerfilter / source / dmapper / DomainMapperTableManager.hxx
blobea1a953c212d251f05546b6681b8068cfe031eb8
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_DOMAIN_MAPPER_TABLE_MANAGER_HXX
20 #define INCLUDED_DOMAIN_MAPPER_TABLE_MANAGER_HXX
22 #include "TablePropertiesHandler.hxx"
23 #include <TablePositionHandler.hxx>
25 #include <resourcemodel/TableManager.hxx>
26 #include <PropertyMap.hxx>
27 #include <StyleSheetTable.hxx>
28 #include <com/sun/star/text/XTextRange.hpp>
29 #include <vector>
31 namespace writerfilter {
32 namespace dmapper {
34 class DomainMapperTableManager : public DomainMapperTableManager_Base_t
36 typedef boost::shared_ptr< std::vector<sal_Int32> > IntVectorPtr;
38 sal_uInt32 m_nRow;
39 ::std::vector< sal_uInt32 > m_nCell;
40 sal_uInt32 m_nGridSpan;
41 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
42 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
43 sal_uInt32 m_nCellBorderIndex; //borders are provided for all cells and need counting
44 sal_Int32 m_nHeaderRepeat; //counter of repeated headers - if == -1 then the repeating stops
45 sal_Int32 m_nTableWidth; //might be set directly or has to be calculated from the column positions
46 bool m_bOOXML;
47 OUString m_sTableStyleName;
48 std::vector< TablePositionHandlerPtr > m_aTablePositions;
49 std::vector< TablePositionHandlerPtr > m_aTmpPosition; ///< Temporarily stores the position to compare it later
50 std::vector< TablePropertyMapPtr > m_aTmpTableProperties; ///< Temporarily stores the table properties until end of row
51 PropertyMapPtr m_pTableStyleTextProperies;
53 ::std::vector< IntVectorPtr > m_aTableGrid;
54 ::std::vector< IntVectorPtr > m_aGridSpans;
55 /// 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.
56 bool m_bPushCurrentWidth;
57 /// Individual table cell width values, used only in case the number of cells doesn't match the table grid.
58 ::std::vector< IntVectorPtr > m_aCellWidths;
59 /// Remember if a cell already set this, then it should not be set at a row level.
60 bool m_bRowSizeTypeInserted;
61 /// At least one cell in the current row has the btLr text direction.
62 bool m_bHasBtlrCell;
63 /// Remember if table width was already set, when we lack a w:tblW, it should be set manually at the end.
64 bool m_bTableSizeTypeInserted;
65 /// Table layout algorithm, IOW if we should consider fixed column width or not.
66 sal_uInt32 m_nLayoutType;
67 sal_Int32 m_nMaxFixedWidth;
69 TablePropertiesHandler *m_pTablePropsHandler;
70 PropertyMapPtr m_pStyleProps;
72 virtual void clearData();
74 public:
76 DomainMapperTableManager(bool bOOXML);
77 virtual ~DomainMapperTableManager();
79 // use this method to avoid adding the properties for the table
80 // but in the provided properties map.
81 inline void SetStyleProperties( PropertyMapPtr pProperties ) { m_pStyleProps = pProperties; };
83 virtual bool sprm(Sprm & rSprm);
85 virtual void startLevel( );
86 virtual void endLevel( );
88 virtual void endOfCellAction();
89 virtual void endOfRowAction();
91 IntVectorPtr getCurrentGrid( );
92 IntVectorPtr getCurrentSpans( );
93 IntVectorPtr getCurrentCellWidths( );
95 const OUString& getTableStyleName() const { return m_sTableStyleName; }
96 const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> getCurrentTablePosition();
98 /// copy the text properties of the table style and its parent into pContext
99 void CopyTextProperties(PropertyMapPtr pContext, StyleSheetTablePtr pStyleSheetTable);
101 inline virtual void cellProps(TablePropertyMapPtr pProps)
103 if ( m_pStyleProps.get( ) )
104 m_pStyleProps->InsertProps(pProps);
105 else
106 DomainMapperTableManager_Base_t::cellProps( pProps );
109 inline virtual void cellPropsByCell(unsigned int i, TablePropertyMapPtr pProps)
111 if ( m_pStyleProps.get( ) )
112 m_pStyleProps->InsertProps(pProps);
113 else
114 DomainMapperTableManager_Base_t::cellPropsByCell( i, pProps );
117 inline virtual void insertRowProps(TablePropertyMapPtr pProps)
119 if ( m_pStyleProps.get( ) )
120 m_pStyleProps->InsertProps(pProps);
121 else
122 DomainMapperTableManager_Base_t::insertRowProps( pProps );
125 inline virtual void insertTableProps(TablePropertyMapPtr pProps)
127 if ( m_pStyleProps.get( ) )
128 m_pStyleProps->InsertProps(pProps);
129 else
130 m_aTmpTableProperties.back()->InsertProps(pProps);
133 bool IsRowSizeTypeInserted() const
135 return m_bRowSizeTypeInserted;
138 bool HasBtlrCell() const
140 return m_bHasBtlrCell;
143 bool IsTableSizeTypeInserted() const
145 return m_bTableSizeTypeInserted;
148 void SetLayoutType(sal_uInt32 nLayoutType)
150 m_nLayoutType = nLayoutType;
157 #endif // INCLUDED_DOMAIN_MAPPER_TABLE_MANAGER_HXX
159 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */