LCOV - code coverage report
Current view: top level - writerfilter/source/dmapper - DomainMapperTableManager.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 24 30 80.0 %
Date: 2015-06-13 12:38:46 Functions: 8 9 88.9 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : #ifndef INCLUDED_WRITERFILTER_SOURCE_DMAPPER_DOMAINMAPPERTABLEMANAGER_HXX
      20             : #define INCLUDED_WRITERFILTER_SOURCE_DMAPPER_DOMAINMAPPERTABLEMANAGER_HXX
      21             : 
      22             : #include "TablePropertiesHandler.hxx"
      23             : #include "TablePositionHandler.hxx"
      24             : 
      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>
      31             : 
      32             : namespace writerfilter {
      33             : namespace dmapper {
      34             : 
      35             : class DomainMapper;
      36             : 
      37             : class DomainMapperTableManager : public TableManager
      38             : {
      39             :     typedef std::shared_ptr< std::vector<sal_Int32> > IntVectorPtr;
      40             : 
      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;
      58             : 
      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;
      74             : 
      75             :     TablePropertiesHandler   *m_pTablePropsHandler;
      76             :     PropertyMapPtr            m_pStyleProps;
      77             : 
      78             :     virtual void clearData() SAL_OVERRIDE;
      79             : 
      80             : public:
      81             : 
      82             :     DomainMapperTableManager();
      83             :     virtual ~DomainMapperTableManager();
      84             : 
      85             :     // use this method to avoid adding the properties for the table
      86             :     // but in the provided properties map.
      87        9804 :     inline void SetStyleProperties( PropertyMapPtr pProperties ) { m_pStyleProps = pProperties; };
      88             : 
      89             :     virtual bool sprm(Sprm & rSprm) SAL_OVERRIDE;
      90             :     bool attribute(Id nName, Value & val);
      91             : 
      92             :     virtual void startLevel( ) SAL_OVERRIDE;
      93             :     virtual void endLevel( ) SAL_OVERRIDE;
      94             : 
      95             :     virtual void endOfCellAction() SAL_OVERRIDE;
      96             :     virtual void endOfRowAction() SAL_OVERRIDE;
      97             : 
      98             :     IntVectorPtr getCurrentGrid( );
      99             :     IntVectorPtr getCurrentSpans( );
     100             :     IntVectorPtr getCurrentCellWidths( );
     101             : 
     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();
     107             : 
     108       19305 :     virtual void cellProps(TablePropertyMapPtr pProps) SAL_OVERRIDE
     109             :     {
     110       19305 :         if ( m_pStyleProps.get( ) )
     111           0 :             m_pStyleProps->InsertProps(pProps);
     112             :         else
     113       19305 :            TableManager::cellProps( pProps );
     114       19305 :     };
     115             : 
     116           0 :     virtual void cellPropsByCell(unsigned int i, TablePropertyMapPtr pProps) SAL_OVERRIDE
     117             :     {
     118           0 :         if ( m_pStyleProps.get( ) )
     119           0 :             m_pStyleProps->InsertProps(pProps);
     120             :         else
     121           0 :            TableManager::cellPropsByCell( i, pProps );
     122           0 :     };
     123             : 
     124        4903 :     virtual void insertRowProps(TablePropertyMapPtr pProps) SAL_OVERRIDE
     125             :     {
     126        4903 :         if ( m_pStyleProps.get( ) )
     127          40 :             m_pStyleProps->InsertProps(pProps);
     128             :         else
     129        4863 :            TableManager::insertRowProps( pProps );
     130        4903 :     };
     131             : 
     132       15039 :     virtual void insertTableProps(TablePropertyMapPtr pProps) SAL_OVERRIDE
     133             :     {
     134       15039 :         if ( m_pStyleProps.get( ) )
     135          40 :             m_pStyleProps->InsertProps(pProps);
     136             :         else
     137       14999 :             m_aTmpTableProperties.back()->InsertProps(pProps);
     138       15039 :     };
     139             : 
     140        1405 :     bool IsRowSizeTypeInserted() const
     141             :     {
     142        1405 :         return m_bRowSizeTypeInserted;
     143             :     }
     144             : 
     145        1407 :     bool HasBtlrCell() const
     146             :     {
     147        1407 :         return m_bHasBtlrCell;
     148             :     }
     149             : 
     150             :     bool IsTableSizeTypeInserted() const
     151             :     {
     152             :         return m_bTableSizeTypeInserted;
     153             :     }
     154             : 
     155         198 :     void SetLayoutType(sal_uInt32 nLayoutType)
     156             :     {
     157         198 :         m_nLayoutType = nLayoutType;
     158         198 :     }
     159             : 
     160       28873 :     bool isInCell()
     161             :     {
     162       28873 :         return TableManager::isInCell();
     163             :     }
     164             : 
     165             :     void setIsInShape(bool bIsInShape);
     166             : 
     167             : };
     168             : 
     169             : }}
     170             : 
     171             : #endif // INCLUDED_WRITERFILTER_SOURCE_DMAPPER_DOMAINMAPPERTABLEMANAGER_HXX
     172             : 
     173             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11