1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef INCLUDED_DOMAIN_MAPPER_TABLE_MANAGER_HXX 24 #define INCLUDED_DOMAIN_MAPPER_TABLE_MANAGER_HXX 25 26 #include "TablePropertiesHandler.hxx" 27 28 #include <resourcemodel/TableManager.hxx> 29 #include <PropertyMap.hxx> 30 #include <StyleSheetTable.hxx> 31 #include <com/sun/star/text/XTextRange.hpp> 32 #include <vector> 33 #include <stack> 34 35 namespace writerfilter { 36 namespace dmapper { 37 38 class DomainMapperTableManager : public DomainMapperTableManager_Base_t 39 { 40 typedef boost::shared_ptr< std::vector<sal_Int32> > IntVectorPtr; 41 42 ::std::stack< sal_uInt32 > m_nCellCounterForCurrentRow; 43 sal_uInt32 m_nGridSpanOfCurrentCell; 44 ::std::stack< sal_uInt32 > m_nCurrentCellBorderIndex; //borders are provided for all cells and need counting 45 ::std::stack< sal_Int32 > m_nCurrentHeaderRepeatCount; //counter of repeated headers - if == -1 then the repeating stops 46 ::std::stack< sal_Int32 > m_nTableWidthOfCurrentTable; //might be set directly or has to be calculated from the column positions 47 bool m_bOOXML; 48 49 ::std::stack< IntVectorPtr > m_aTableGrid; 50 ::std::stack< IntVectorPtr > m_aGridSpans; 51 52 TablePropertiesHandler *m_pTablePropsHandler; 53 PropertyMapPtr m_pStyleProps; 54 55 void pushStackOfMembers(); 56 void popStackOfMembers(); 57 58 IntVectorPtr getCurrentGrid(); 59 IntVectorPtr getCurrentSpans( ); 60 61 public: 62 63 DomainMapperTableManager(bool bOOXML); 64 virtual ~DomainMapperTableManager(); 65 66 // use this method to avoid adding the properties for the table 67 // but in the provided properties map. 68 void SetStyleProperties( PropertyMapPtr pProperties ); 69 70 virtual bool sprm(Sprm & rSprm); 71 72 virtual void startLevel(); 73 virtual void endLevel(); 74 75 virtual void endOfCellAction(); 76 virtual void endOfRowAction(); 77 cellProps(TablePropertyMapPtr pProps)78 inline virtual void cellProps(TablePropertyMapPtr pProps) 79 { 80 if ( m_pStyleProps.get( ) ) 81 m_pStyleProps->insert( pProps, true ); 82 else 83 DomainMapperTableManager_Base_t::cellProps( pProps ); 84 }; 85 cellPropsByCell(unsigned int i,TablePropertyMapPtr pProps)86 inline virtual void cellPropsByCell(unsigned int i, TablePropertyMapPtr pProps) 87 { 88 if ( m_pStyleProps.get( ) ) 89 m_pStyleProps->insert( pProps, true ); 90 else 91 DomainMapperTableManager_Base_t::cellPropsByCell( i, pProps ); 92 }; 93 insertRowProps(TablePropertyMapPtr pProps)94 inline virtual void insertRowProps(TablePropertyMapPtr pProps) 95 { 96 if ( m_pStyleProps.get( ) ) 97 m_pStyleProps->insert( pProps, true ); 98 else 99 DomainMapperTableManager_Base_t::insertRowProps( pProps ); 100 }; 101 insertTableProps(TablePropertyMapPtr pProps)102 inline virtual void insertTableProps(TablePropertyMapPtr pProps) 103 { 104 if ( m_pStyleProps.get( ) ) 105 m_pStyleProps->insert( pProps, true ); 106 else 107 DomainMapperTableManager_Base_t::insertTableProps( pProps ); 108 }; 109 110 }; 111 112 }} 113 114 #endif // INCLUDED_DOMAIN_MAPPER_TABLE_MANAGER_HXX 115