LCOV - code coverage report
Current view: top level - writerfilter/source/dmapper - DomainMapperTableManager.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 22 28 78.6 %
Date: 2014-04-11 Functions: 7 8 87.5 %
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_DOMAIN_MAPPER_TABLE_MANAGER_HXX
      20             : #define INCLUDED_DOMAIN_MAPPER_TABLE_MANAGER_HXX
      21             : 
      22             : #include "TablePropertiesHandler.hxx"
      23             : #include <TablePositionHandler.hxx>
      24             : 
      25             : #include <resourcemodel/TableManager.hxx>
      26             : #include <PropertyMap.hxx>
      27             : #include <StyleSheetTable.hxx>
      28             : #include <com/sun/star/text/XTextRange.hpp>
      29             : #include <vector>
      30             : 
      31             : namespace writerfilter {
      32             : namespace dmapper {
      33             : 
      34             : class DomainMapperTableManager : public DomainMapperTableManager_Base_t
      35             : {
      36             :     typedef boost::shared_ptr< std::vector<sal_Int32> > IntVectorPtr;
      37             : 
      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;
      52             : 
      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;
      68             : 
      69             :     TablePropertiesHandler   *m_pTablePropsHandler;
      70             :     PropertyMapPtr            m_pStyleProps;
      71             : 
      72             :     virtual void clearData() SAL_OVERRIDE;
      73             : 
      74             : public:
      75             : 
      76             :     DomainMapperTableManager(bool bOOXML);
      77             :     virtual ~DomainMapperTableManager();
      78             : 
      79             :     // use this method to avoid adding the properties for the table
      80             :     // but in the provided properties map.
      81        3374 :     inline void SetStyleProperties( PropertyMapPtr pProperties ) { m_pStyleProps = pProperties; };
      82             : 
      83             :     virtual bool sprm(Sprm & rSprm) SAL_OVERRIDE;
      84             : 
      85             :     virtual void startLevel( ) SAL_OVERRIDE;
      86             :     virtual void endLevel( ) SAL_OVERRIDE;
      87             : 
      88             :     virtual void endOfCellAction() SAL_OVERRIDE;
      89             :     virtual void endOfRowAction() SAL_OVERRIDE;
      90             : 
      91             :     IntVectorPtr getCurrentGrid( );
      92             :     IntVectorPtr getCurrentSpans( );
      93             :     IntVectorPtr getCurrentCellWidths( );
      94             : 
      95             :     const OUString& getTableStyleName() const { return m_sTableStyleName; }
      96             :     const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> getCurrentTablePosition();
      97             : 
      98        9057 :     virtual void cellProps(TablePropertyMapPtr pProps) SAL_OVERRIDE
      99             :     {
     100        9057 :         if ( m_pStyleProps.get( ) )
     101           0 :             m_pStyleProps->InsertProps(pProps);
     102             :         else
     103        9057 :            DomainMapperTableManager_Base_t::cellProps( pProps );
     104        9057 :     };
     105             : 
     106           0 :     virtual void cellPropsByCell(unsigned int i, TablePropertyMapPtr pProps) SAL_OVERRIDE
     107             :     {
     108           0 :         if ( m_pStyleProps.get( ) )
     109           0 :             m_pStyleProps->InsertProps(pProps);
     110             :         else
     111           0 :            DomainMapperTableManager_Base_t::cellPropsByCell( i, pProps );
     112           0 :     };
     113             : 
     114        3623 :     virtual void insertRowProps(TablePropertyMapPtr pProps) SAL_OVERRIDE
     115             :     {
     116        3623 :         if ( m_pStyleProps.get( ) )
     117           8 :             m_pStyleProps->InsertProps(pProps);
     118             :         else
     119        3615 :            DomainMapperTableManager_Base_t::insertRowProps( pProps );
     120        3623 :     };
     121             : 
     122        8307 :     virtual void insertTableProps(TablePropertyMapPtr pProps) SAL_OVERRIDE
     123             :     {
     124        8307 :         if ( m_pStyleProps.get( ) )
     125           8 :             m_pStyleProps->InsertProps(pProps);
     126             :         else
     127        8299 :             m_aTmpTableProperties.back()->InsertProps(pProps);
     128        8307 :     };
     129             : 
     130        1197 :     bool IsRowSizeTypeInserted() const
     131             :     {
     132        1197 :         return m_bRowSizeTypeInserted;
     133             :     }
     134             : 
     135        1214 :     bool HasBtlrCell() const
     136             :     {
     137        1214 :         return m_bHasBtlrCell;
     138             :     }
     139             : 
     140             :     bool IsTableSizeTypeInserted() const
     141             :     {
     142             :         return m_bTableSizeTypeInserted;
     143             :     }
     144             : 
     145         259 :     void SetLayoutType(sal_uInt32 nLayoutType)
     146             :     {
     147         259 :         m_nLayoutType = nLayoutType;
     148         259 :     }
     149             : 
     150             : };
     151             : 
     152             : }}
     153             : 
     154             : #endif // INCLUDED_DOMAIN_MAPPER_TABLE_MANAGER_HXX
     155             : 
     156             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10